change TyF64 to f64 according to JsonSchema and cleanup docs code (#6081)
* cleanup gen_std Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix table Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
		@ -329,7 +329,7 @@ fn do_stdlib_inner(
 | 
			
		||||
        let camel_case_arg_name = to_camel_case(&arg_name);
 | 
			
		||||
        if ty_string != "ExecState" && ty_string != "Args" {
 | 
			
		||||
            let schema = quote! {
 | 
			
		||||
                #docs_crate::cleanup_number_tuples_root(generator.root_schema_for::<#ty_ident>())
 | 
			
		||||
                generator.root_schema_for::<#ty_ident>()
 | 
			
		||||
            };
 | 
			
		||||
            arg_types.push(quote! {
 | 
			
		||||
                #docs_crate::StdLibFnArg {
 | 
			
		||||
@ -394,7 +394,7 @@ fn do_stdlib_inner(
 | 
			
		||||
    let return_type = if !ret_ty_string.is_empty() || ret_ty_string != "()" {
 | 
			
		||||
        let ret_ty_string = rust_type_to_openapi_type(&ret_ty_string);
 | 
			
		||||
        quote! {
 | 
			
		||||
            let schema = #docs_crate::cleanup_number_tuples_root(generator.root_schema_for::<#return_type_inner>());
 | 
			
		||||
            let schema = generator.root_schema_for::<#return_type_inner>();
 | 
			
		||||
            Some(#docs_crate::StdLibFnArg {
 | 
			
		||||
                name: "".to_string(),
 | 
			
		||||
                type_: #ret_ty_string.to_string(),
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ impl crate::docs::StdLibFn for SomeFn {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "data".to_string(),
 | 
			
		||||
            type_: "Foo".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Foo>()),
 | 
			
		||||
            schema: generator.root_schema_for::<Foo>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -114,7 +114,7 @@ impl crate::docs::StdLibFn for SomeFn {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
 | 
			
		||||
        let schema = generator.root_schema_for::<i32>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "i32".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ impl crate::docs::StdLibFn for SomeFn {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "data".to_string(),
 | 
			
		||||
            type_: "string".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<str>()),
 | 
			
		||||
            schema: generator.root_schema_for::<str>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -114,7 +114,7 @@ impl crate::docs::StdLibFn for SomeFn {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
 | 
			
		||||
        let schema = generator.root_schema_for::<i32>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "i32".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "[number]".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<[f64; 2usize]>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<[f64; 2usize]>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
 | 
			
		||||
        let schema = generator.root_schema_for::<f64>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,7 +103,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>()),
 | 
			
		||||
            schema: generator.root_schema_for::<f64>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -115,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
 | 
			
		||||
        let schema = generator.root_schema_for::<f64>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -104,9 +104,7 @@ impl crate::docs::StdLibFn for MyFunc {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "kittycad::types::InputFormat".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            required: false,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -118,8 +116,7 @@ impl crate::docs::StdLibFn for MyFunc {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema =
 | 
			
		||||
            crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
 | 
			
		||||
        let schema = generator.root_schema_for::<Vec<Sketch>>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "[Sketch]".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -105,9 +105,7 @@ impl crate::docs::StdLibFn for LineTo {
 | 
			
		||||
            crate::docs::StdLibFnArg {
 | 
			
		||||
                name: "data".to_string(),
 | 
			
		||||
                type_: "LineToData".to_string(),
 | 
			
		||||
                schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                    generator.root_schema_for::<LineToData>(),
 | 
			
		||||
                ),
 | 
			
		||||
                schema: generator.root_schema_for::<LineToData>(),
 | 
			
		||||
                required: true,
 | 
			
		||||
                label_required: true,
 | 
			
		||||
                description: String::new().to_string(),
 | 
			
		||||
@ -116,9 +114,7 @@ impl crate::docs::StdLibFn for LineTo {
 | 
			
		||||
            crate::docs::StdLibFnArg {
 | 
			
		||||
                name: "sketch".to_string(),
 | 
			
		||||
                type_: "Sketch".to_string(),
 | 
			
		||||
                schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                    generator.root_schema_for::<Sketch>(),
 | 
			
		||||
                ),
 | 
			
		||||
                schema: generator.root_schema_for::<Sketch>(),
 | 
			
		||||
                required: true,
 | 
			
		||||
                label_required: true,
 | 
			
		||||
                description: "the sketch you're adding the line to".to_string(),
 | 
			
		||||
@ -131,7 +127,7 @@ impl crate::docs::StdLibFn for LineTo {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Sketch>());
 | 
			
		||||
        let schema = generator.root_schema_for::<Sketch>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "Sketch".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Min {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "[number]".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Vec<f64>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Vec<f64>>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,7 +115,7 @@ impl crate::docs::StdLibFn for Min {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
 | 
			
		||||
        let schema = generator.root_schema_for::<f64>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Option<f64>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Option<f64>>(),
 | 
			
		||||
            required: false,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
 | 
			
		||||
        let schema = generator.root_schema_for::<f64>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "kittycad::types::InputFormat".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            required: false,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,7 +115,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<f64>());
 | 
			
		||||
        let schema = generator.root_schema_for::<f64>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "number".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "kittycad::types::InputFormat".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            required: false,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,8 +115,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema =
 | 
			
		||||
            crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
 | 
			
		||||
        let schema = generator.root_schema_for::<Vec<Sketch>>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "[Sketch]".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "kittycad::types::InputFormat".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Option<kittycad::types::InputFormat>>(),
 | 
			
		||||
            required: false,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,8 +115,7 @@ impl crate::docs::StdLibFn for Import {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema =
 | 
			
		||||
            crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<Vec<Sketch>>());
 | 
			
		||||
        let schema = generator.root_schema_for::<Vec<Sketch>>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "[Sketch]".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -103,9 +103,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        vec![crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "args".to_string(),
 | 
			
		||||
            type_: "[number]".to_string(),
 | 
			
		||||
            schema: crate::docs::cleanup_number_tuples_root(
 | 
			
		||||
                generator.root_schema_for::<Vec<f64>>(),
 | 
			
		||||
            ),
 | 
			
		||||
            schema: generator.root_schema_for::<Vec<f64>>(),
 | 
			
		||||
            required: true,
 | 
			
		||||
            label_required: true,
 | 
			
		||||
            description: String::new().to_string(),
 | 
			
		||||
@ -117,7 +115,7 @@ impl crate::docs::StdLibFn for Show {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<()>());
 | 
			
		||||
        let schema = generator.root_schema_for::<()>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "()".to_string(),
 | 
			
		||||
 | 
			
		||||
@ -106,7 +106,7 @@ impl crate::docs::StdLibFn for SomeFunction {
 | 
			
		||||
        let mut settings = schemars::gen::SchemaSettings::openapi3();
 | 
			
		||||
        settings.inline_subschemas = inline_subschemas;
 | 
			
		||||
        let mut generator = schemars::gen::SchemaGenerator::new(settings);
 | 
			
		||||
        let schema = crate::docs::cleanup_number_tuples_root(generator.root_schema_for::<i32>());
 | 
			
		||||
        let schema = generator.root_schema_for::<i32>();
 | 
			
		||||
        Some(crate::docs::StdLibFnArg {
 | 
			
		||||
            name: "".to_string(),
 | 
			
		||||
            type_: "i32".to_string(),
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user