├── .github ├── actions │ ├── gitlog │ │ ├── action.yaml │ │ └── gitlog.sh │ └── publish │ │ ├── action.yaml │ │ └── publish.sh └── workflows │ ├── build.yaml │ ├── draft.yaml │ └── release.yaml ├── .gitignore ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── examples ├── README.md ├── actix-web-multipart │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── actix-web-multiple-api-docs-with-scopes │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── actix-web-scopes-binding │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── axum-multipart │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── axum-utoipa-bindings │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── axum-utoipa-docker ├── axum-utoipa-nesting-vendored │ ├── Cargo.toml │ ├── Dockerfile │ ├── README.md │ └── src │ │ └── main.rs ├── generics-actix │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── raw-json-actix │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── rocket-todo │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── simple-axum │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── simple-x-extensions │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── todo-actix │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── main.rs │ │ └── todo.rs ├── todo-axum │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── todo-tide │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── todo-warp-rapidoc │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── todo-warp-redoc-with-file-config │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── redoc.json │ └── src │ │ └── main.rs ├── todo-warp │ ├── Cargo.toml │ ├── README.md │ └── src │ │ └── main.rs ├── utoipa-config-test │ └── README.md └── warp-multiple-api-docs │ ├── Cargo.toml │ ├── README.md │ └── src │ └── main.rs ├── scripts ├── coverage.sh ├── doc.sh ├── test.sh ├── update-swagger-ui.sh └── validate-examples.sh ├── utoipa-actix-web ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── lib.rs │ ├── scope.rs │ └── service_config.rs └── testdata │ └── app_generated_openapi ├── utoipa-axum ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src │ ├── lib.rs │ ├── router.rs │ └── snapshots │ └── utoipa_axum__tests__axum_router.snap ├── utoipa-config ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── config-test-crate │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── src │ │ └── main.rs │ └── tests │ │ └── config.rs └── src │ └── lib.rs ├── utoipa-gen ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── src │ ├── component.rs │ ├── component │ │ ├── features.rs │ │ ├── features │ │ │ ├── attributes.rs │ │ │ ├── attributes │ │ │ │ └── extensions.rs │ │ │ ├── validation.rs │ │ │ └── validators.rs │ │ ├── into_params.rs │ │ ├── schema.rs │ │ ├── schema │ │ │ ├── enums.rs │ │ │ ├── features.rs │ │ │ └── xml.rs │ │ └── serde.rs │ ├── doc_comment.rs │ ├── ext.rs │ ├── ext │ │ ├── actix.rs │ │ ├── auto_types.rs │ │ ├── axum.rs │ │ └── rocket.rs │ ├── lib.rs │ ├── openapi.rs │ ├── openapi │ │ └── info.rs │ ├── path.rs │ ├── path │ │ ├── example.rs │ │ ├── handler.rs │ │ ├── media_type.rs │ │ ├── media_type │ │ │ └── encoding.rs │ │ ├── parameter.rs │ │ ├── request_body.rs │ │ ├── response.rs │ │ ├── response │ │ │ ├── derive.rs │ │ │ ├── header.rs │ │ │ └── link.rs │ │ └── status.rs │ ├── schema_type.rs │ ├── security_requirement.rs │ └── snapshots │ │ └── doctest_lib_rs__schema.snap └── tests │ ├── common.rs │ ├── modify_test.rs │ ├── openapi_derive.rs │ ├── openapi_derive_test.rs │ ├── path_derive.rs │ ├── path_derive_actix.rs │ ├── path_derive_auto_into_responses.rs │ ├── path_derive_auto_into_responses_actix.rs │ ├── path_derive_auto_into_responses_axum.rs │ ├── path_derive_axum_test.rs │ ├── path_derive_rocket.rs │ ├── path_parameter_derive_actix.rs │ ├── path_parameter_derive_test.rs │ ├── path_response_derive_test.rs │ ├── request_body_derive_test.rs │ ├── response_derive_test.rs │ ├── schema_derive_test.rs │ ├── schema_generics.rs │ ├── snapshots │ ├── openapi_derive__derive_generic_openapi_component_schemas.snap │ ├── openapi_derive__derive_logical_or_security_requirement.snap │ ├── openapi_derive__derive_nest_openapi_with_tags.snap │ ├── openapi_derive__derive_openapi_with_custom_info.snap │ ├── openapi_derive__derive_openapi_with_generic_response.snap │ ├── openapi_derive__derive_openapi_with_generic_schema.snap │ ├── openapi_derive__derive_openapi_with_generic_schema_with_as.snap │ ├── openapi_derive__derive_openapi_with_include_str_description.snap │ ├── openapi_derive__derive_openapi_with_licence.snap │ ├── openapi_derive__derive_openapi_with_responses.snap │ ├── openapi_derive__derive_openapi_with_servers.snap │ ├── openapi_derive__openapi_resolvle_recursive_references.snap │ ├── openapi_derive__openapi_schemas_resolve_generic_enum_schema.snap │ ├── openapi_derive__openapi_schemas_resolve_schema_references.snap │ ├── path_derive__arbitrary_expr_in_operation_id.snap │ ├── path_derive__derive_images_as_application_octet_stream.snap │ ├── path_derive__derive_img_png_request_body.snap │ ├── path_derive__derive_into_params_required.snap │ ├── path_derive__derive_into_params_with_ignored_eq_false_field.snap │ ├── path_derive__derive_into_params_with_ignored_field.snap │ ├── path_derive__derive_into_params_with_serde_skip.snap │ ├── path_derive__derive_into_params_with_serde_skip_deserializing.snap │ ├── path_derive__derive_into_params_with_serde_skip_serializing.snap │ ├── path_derive__derive_multipart_form_data.snap │ ├── path_derive__derive_octet_stream_request_body.snap │ ├── path_derive__derive_path_include_str_description.snap │ ├── path_derive__derive_path_parameters_container_level_default.snap │ ├── path_derive__derive_path_params_always_required.snap │ ├── path_derive__derive_path_params_custom_rename_all.snap │ ├── path_derive__derive_path_params_custom_rename_all_serde_will_override.snap │ ├── path_derive__derive_path_params_into_params_with_raw_identifier.snap │ ├── path_derive__derive_path_params_into_params_with_unit_type.snap │ ├── path_derive__derive_path_params_into_params_with_value_type.snap │ ├── path_derive__derive_path_params_intoparams.snap │ ├── path_derive__derive_path_params_map.snap │ ├── path_derive__derive_path_params_with_examples.snap │ ├── path_derive__derive_path_params_with_serde_and_custom_rename.snap │ ├── path_derive__derive_path_query_params_with_schema_features.snap │ ├── path_derive__derive_path_test_collect_generic_array_request_body.snap │ ├── path_derive__derive_path_test_collect_generic_request_body.snap │ ├── path_derive__derive_path_test_collect_request_body.snap │ ├── path_derive__derive_path_test_do_not_collect_inlined_schema.snap │ ├── path_derive__derive_path_test_do_not_collect_recursive_inlined.snap │ ├── path_derive__derive_path_with_datetime_format_path_parameter.snap │ ├── path_derive__derive_path_with_datetime_format_query_parameter.snap │ ├── path_derive__derive_path_with_description_and_summary_override.snap │ ├── path_derive__derive_path_with_extensions-2.snap │ ├── path_derive__derive_path_with_extensions.snap │ ├── path_derive__derive_path_with_into_params_custom_schema.snap │ ├── path_derive__derive_path_with_into_responses.snap │ ├── path_derive__derive_path_with_multiple_methods.snap │ ├── path_derive__derive_path_with_multiple_tags.snap │ ├── path_derive__derive_path_with_parameter_inline_schema.snap │ ├── path_derive__derive_path_with_parameter_schema.snap │ ├── path_derive__derive_path_with_response_links.snap │ ├── path_derive__derive_path_with_tag_constant.snap │ ├── path_derive__derive_path_with_validation_attributes.snap │ ├── path_derive__derive_required_path_params.snap │ ├── path_derive__path_and_nest_with_additional_tags.snap │ ├── path_derive__path_and_nest_with_default_tags_from_path.snap │ ├── path_derive__path_derive_with_body_ref_using_as_attribute_schema.snap │ ├── path_derive__path_nest_without_any_tags.snap │ ├── path_derive__path_parameters_with_free_form_properties.snap │ ├── path_derive_actix__path_derive_custom_generic_wrapper-2.snap │ ├── path_derive_actix__path_derive_custom_generic_wrapper.snap │ ├── path_derive_actix__path_with_all_args-2.snap │ ├── path_derive_actix__path_with_all_args.snap │ ├── path_derive_actix__path_with_all_args_using_custom_uuid-2.snap │ ├── path_derive_actix__path_with_all_args_using_custom_uuid.snap │ ├── path_derive_actix__path_with_all_args_using_uuid-2.snap │ ├── path_derive_actix__path_with_all_args_using_uuid.snap │ ├── path_derive_auto_into_responses__path_operation_auto_types_default_response_type.snap │ ├── path_derive_auto_into_responses__path_operation_auto_types_responses.snap │ ├── path_derive_auto_into_responses_actix__path_operation_auto_types_fn_parameters-2.snap │ ├── path_derive_auto_into_responses_actix__path_operation_auto_types_fn_parameters.snap │ ├── path_derive_auto_into_responses_actix__path_operation_auto_types_tuple.snap │ ├── path_derive_auto_into_responses_actix__path_operation_optional_json_body-2.snap │ ├── path_derive_auto_into_responses_actix__path_operation_optional_json_body.snap │ ├── path_derive_auto_into_responses_actix__path_operation_request_body_form.snap │ ├── path_derive_auto_into_responses_axum__path_operation_auto_types_responses.snap │ ├── path_derive_axum_test__derive_path_params_into_params_axum.snap │ ├── path_derive_axum_test__derive_path_params_into_params_unnamed.snap │ ├── path_derive_axum_test__derive_path_params_with_ignored_parameter.snap │ ├── path_derive_axum_test__derive_path_params_with_unnamed_struct_destructed.snap │ ├── path_derive_axum_test__derive_path_query_params_with_named_struct_destructed.snap │ ├── path_derive_axum_test__derive_path_with_validation_attributes_axum.snap │ ├── path_derive_axum_test__get_todo_with_path_tuple.snap │ ├── path_derive_axum_test__into_params_for_option_query_type.snap │ ├── path_derive_axum_test__path_derive_inline_with_tuple.snap │ ├── path_derive_axum_test__path_param_single_arg_non_primitive_type.snap │ ├── path_derive_axum_test__path_param_single_arg_non_primitive_type_into_params.snap │ ├── path_derive_axum_test__path_param_single_arg_primitive_type.snap │ ├── path_derive_axum_test__path_with_path_query_body_resolved-2.snap │ ├── path_derive_axum_test__path_with_path_query_body_resolved.snap │ ├── path_derive_rocket__derive_rocket_path_with_query_params_in_option.snap │ ├── path_derive_rocket__path_with_all_args_and_body-2.snap │ ├── path_derive_rocket__path_with_all_args_and_body.snap │ ├── path_derive_rocket__path_with_enum_path_param.snap │ ├── path_derive_rocket__resolve_get_with_optional_query_args.snap │ ├── path_derive_rocket__resolve_path_query_params_from_form.snap │ ├── path_parameter_derive_test__derive_into_params_required_custom_query_parameter_required.snap │ ├── path_parameter_derive_test__derive_path_params_with_parameter_type_args.snap │ ├── path_parameter_derive_test__path_parameter_with_extensions.snap │ ├── path_response_derive_test__derive_http_status_code_responses.snap │ ├── path_response_derive_test__derive_path_with_multiple_examples_auto_collect_schemas-2.snap │ ├── path_response_derive_test__derive_path_with_multiple_examples_auto_collect_schemas.snap │ ├── path_response_derive_test__derive_path_with_multiple_responses_via_content_attribute_auto_collect_responses-2.snap │ ├── path_response_derive_test__derive_path_with_multiple_responses_via_content_attribute_auto_collect_responses.snap │ ├── path_response_derive_test__derive_path_with_multiple_responses_with_multiple_examples.snap │ ├── path_response_derive_test__derive_response_body_inline_schema_component.snap │ ├── path_response_derive_test__path_response_default_no_value_nor_ref.snap │ ├── path_response_derive_test__path_response_with_extensions.snap │ ├── path_response_derive_test__path_response_with_external_ref.snap │ ├── path_response_derive_test__path_response_with_inline_ref_type.snap │ ├── path_response_derive_test__path_response_with_no_schema.snap │ ├── request_body_derive_test__derive_request_body_complex_multi_content_type_success.snap │ ├── request_body_derive_test__derive_request_body_complex_primitive_array_success.snap │ ├── request_body_derive_test__derive_request_body_complex_required_explicit_false_success.snap │ ├── request_body_derive_test__derive_request_body_complex_success.snap │ ├── request_body_derive_test__derive_request_body_complex_success_array.snap │ ├── request_body_derive_test__derive_request_body_complex_success_inline.snap │ ├── request_body_derive_test__derive_request_body_complex_success_inline_array.snap │ ├── request_body_derive_test__derive_request_body_option_array_success.snap │ ├── request_body_derive_test__derive_request_body_primitive_array_success.snap │ ├── request_body_derive_test__derive_request_body_simple_inline_success.snap │ ├── request_body_derive_test__derive_request_body_with_multiple_content_type_guess_default_content_type.snap │ ├── request_body_derive_test__multiple_content_with_examples.snap │ ├── request_body_derive_test__multiple_request_body_with_only_content_type.snap │ ├── request_body_derive_test__request_body_with_binary.snap │ ├── request_body_derive_test__request_body_with_example.snap │ ├── request_body_derive_test__request_body_with_examples.snap │ ├── request_body_derive_test__request_body_with_extensions.snap │ ├── request_body_derive_test__request_body_with_external_ref.snap │ ├── request_body_derive_test__request_body_with_only_single_content_type.snap │ ├── request_body_derive_test__unit_type_request_body.snap │ ├── response_derive_test__derive_enum_response.snap │ ├── response_derive_test__derive_into_responses_enum_with_multiple_responses.snap │ ├── response_derive_test__derive_into_responses_inline_named_struct_response.snap │ ├── response_derive_test__derive_into_responses_unit_struct.snap │ ├── response_derive_test__derive_into_responses_unnamed_struct_inline_schema.snap │ ├── response_derive_test__derive_into_responses_unnamed_struct_ref_response.snap │ ├── response_derive_test__derive_into_responses_unnamed_struct_ref_schema.snap │ ├── response_derive_test__derive_into_responses_unnamed_struct_to_response.snap │ ├── response_derive_test__derive_into_responses_unnamed_struct_with_primitive_schema.snap │ ├── response_derive_test__derive_name_struct_response.snap │ ├── response_derive_test__derive_response_multiple_examples.snap │ ├── response_derive_test__derive_response_with_attributes.snap │ ├── response_derive_test__derive_response_with_enum_contents.snap │ ├── response_derive_test__derive_response_with_enum_contents_inlined.snap │ ├── response_derive_test__derive_response_with_inline_unnamed_schema.snap │ ├── response_derive_test__derive_response_with_unit_type.snap │ ├── response_derive_test__derive_struct_response_with_description.snap │ ├── response_derive_test__derive_unnamed_struct_response.snap │ ├── schema_derive_test__const_generic_test.snap │ ├── schema_derive_test__content_encoding_named_field.snap │ ├── schema_derive_test__content_media_type_named_field.snap │ ├── schema_derive_test__derive_btreeset.snap │ ├── schema_derive_test__derive_complex_unnamed_field_reference_with_comment.snap │ ├── schema_derive_test__derive_component_with_generic_types_having_path_expression.snap │ ├── schema_derive_test__derive_component_with_jiff_0_2_feature.snap │ ├── schema_derive_test__derive_component_with_linked_list.snap │ ├── schema_derive_test__derive_component_with_mixed_enum_lifetimes.snap │ ├── schema_derive_test__derive_component_with_raw_identifier.snap │ ├── schema_derive_test__derive_component_with_smallvec_feature.snap │ ├── schema_derive_test__derive_component_with_time_feature.snap │ ├── schema_derive_test__derive_component_with_to_schema_value_type.snap │ ├── schema_derive_test__derive_enum_with_inline_variant.snap │ ├── schema_derive_test__derive_enum_with_named_fields_with_reference_with_tag.snap │ ├── schema_derive_test__derive_enum_with_self_reference.snap │ ├── schema_derive_test__derive_enum_with_title.snap │ ├── schema_derive_test__derive_enum_with_unnamed_primitive_field_with_tag.snap │ ├── schema_derive_test__derive_enum_with_unnamed_single_field_with_tag.snap │ ├── schema_derive_test__derive_flattened_map_ref_property.snap │ ├── schema_derive_test__derive_flattened_map_string_property.snap │ ├── schema_derive_test__derive_hashset.snap │ ├── schema_derive_test__derive_map_free_form_property.snap │ ├── schema_derive_test__derive_map_ref.snap │ ├── schema_derive_test__derive_map_with_property_names.snap │ ├── schema_derive_test__derive_mixed_enum.snap │ ├── schema_derive_test__derive_mixed_enum_as.snap │ ├── schema_derive_test__derive_mixed_enum_custom_rename.snap │ ├── schema_derive_test__derive_mixed_enum_deprecated_variants.snap │ ├── schema_derive_test__derive_mixed_enum_description_override.snap │ ├── schema_derive_test__derive_mixed_enum_example.snap │ ├── schema_derive_test__derive_mixed_enum_serde_adjacently_tagged.snap │ ├── schema_derive_test__derive_mixed_enum_serde_rename_all.snap │ ├── schema_derive_test__derive_mixed_enum_serde_rename_variant.snap │ ├── schema_derive_test__derive_mixed_enum_serde_tag.snap │ ├── schema_derive_test__derive_mixed_enum_serde_tag_title.snap │ ├── schema_derive_test__derive_mixed_enum_serde_untagged.snap │ ├── schema_derive_test__derive_mixed_enum_title.snap │ ├── schema_derive_test__derive_mixed_enum_use_serde_rename_over_custom_rename.snap │ ├── schema_derive_test__derive_mixed_enum_with_discriminator_simple_form.snap │ ├── schema_derive_test__derive_mixed_enum_with_discriminator_with_mapping.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_adjacently_tagged.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_adjacently_tagged_named_fields.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_adjacently_tagged_named_fields_rename_all.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_untagged.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_untagged_named_fields.snap │ ├── schema_derive_test__derive_mixed_enum_with_ref_serde_untagged_named_fields_rename_all.snap │ ├── schema_derive_test__derive_mixed_enum_with_schema_properties.snap │ ├── schema_derive_test__derive_mixed_enum_with_title.snap │ ├── schema_derive_test__derive_negative_numbers.snap │ ├── schema_derive_test__derive_nullable_tuple.snap │ ├── schema_derive_test__derive_parse_serde_field_attributes.snap │ ├── schema_derive_test__derive_schema_multiple_serde_definitions.snap │ ├── schema_derive_test__derive_schema_required_custom_type_required.snap │ ├── schema_derive_test__derive_schema_unnamed_title-2.snap │ ├── schema_derive_test__derive_schema_unnamed_title.snap │ ├── schema_derive_test__derive_schema_with_custom_field_with_schema.snap │ ├── schema_derive_test__derive_schema_with_default_field.snap │ ├── schema_derive_test__derive_schema_with_default_struct.snap │ ├── schema_derive_test__derive_schema_with_docstring_on_tuple_variant_first_element_option-2.snap │ ├── schema_derive_test__derive_schema_with_docstring_on_tuple_variant_first_element_option.snap │ ├── schema_derive_test__derive_schema_with_docstring_on_unit_variant_of_enum.snap │ ├── schema_derive_test__derive_schema_with_explicit_value_type.snap │ ├── schema_derive_test__derive_schema_with_ignore_eq_call_field.snap │ ├── schema_derive_test__derive_schema_with_ignore_eq_false_field.snap │ ├── schema_derive_test__derive_schema_with_ignored_field.snap │ ├── schema_derive_test__derive_schema_with_implicit_value_type.snap │ ├── schema_derive_test__derive_schema_with_multiple_schema_attributes.snap │ ├── schema_derive_test__derive_schema_with_object_type_description.snap │ ├── schema_derive_test__derive_schema_with_slice_and_array.snap │ ├── schema_derive_test__derive_schema_with_unit_hashmap.snap │ ├── schema_derive_test__derive_serde_flatten-2.snap │ ├── schema_derive_test__derive_serde_flatten.snap │ ├── schema_derive_test__derive_simple_enum.snap │ ├── schema_derive_test__derive_simple_enum_description_override.snap │ ├── schema_derive_test__derive_simple_enum_serde_tag.snap │ ├── schema_derive_test__derive_simple_enum_serde_tag_with_flatten_content.snap │ ├── schema_derive_test__derive_simple_enum_serde_untagged.snap │ ├── schema_derive_test__derive_struct_custom_rename.snap │ ├── schema_derive_test__derive_struct_field_with_example.snap │ ├── schema_derive_test__derive_struct_inline_with_description.snap │ ├── schema_derive_test__derive_struct_override_type_with_a_reference.snap │ ├── schema_derive_test__derive_struct_override_type_with_object_type.snap │ ├── schema_derive_test__derive_struct_unnamed_field_reference_with_comment.snap │ ├── schema_derive_test__derive_struct_with_arc.snap │ ├── schema_derive_test__derive_struct_with_collection_of_arcs.snap │ ├── schema_derive_test__derive_struct_with_comments.snap │ ├── schema_derive_test__derive_struct_with_default_attr_field.snap │ ├── schema_derive_test__derive_struct_with_deprecated_fields.snap │ ├── schema_derive_test__derive_struct_with_description_override.snap │ ├── schema_derive_test__derive_struct_with_examples.snap │ ├── schema_derive_test__derive_struct_with_inline.snap │ ├── schema_derive_test__derive_struct_with_nested_arc.snap │ ├── schema_derive_test__derive_struct_with_no_additional_properties.snap │ ├── schema_derive_test__derive_struct_with_nullable_and_required.snap │ ├── schema_derive_test__derive_struct_with_optional_properties.snap │ ├── schema_derive_test__derive_struct_with_rc.snap │ ├── schema_derive_test__derive_struct_with_schema_deprecated_fields.snap │ ├── schema_derive_test__derive_struct_with_self_reference.snap │ ├── schema_derive_test__derive_struct_with_title.snap │ ├── schema_derive_test__derive_struct_with_vec_field_with_example.snap │ ├── schema_derive_test__derive_struct_xml_with_optional_vec.snap │ ├── schema_derive_test__derive_tuple_named_struct_field.snap │ ├── schema_derive_test__derive_unit_struct_schema.snap │ ├── schema_derive_test__derive_unit_type.snap │ ├── schema_derive_test__derive_unit_type_untagged_enum.snap │ ├── schema_derive_test__derive_unnamed_struct_with_description_override.snap │ ├── schema_derive_test__derive_unnamed_struct_with_self_reference.snap │ ├── schema_derive_test__derive_unnamed_structs_with_examples-2.snap │ ├── schema_derive_test__derive_unnamed_structs_with_examples.snap │ ├── schema_derive_test__derive_untagged_with_unit_variant.snap │ ├── schema_derive_test__new_type_struct_pattern.snap │ ├── schema_derive_test__non_strict_integers.snap │ ├── schema_derive_test__schema_manual_impl.snap │ ├── schema_derive_test__strict_integers.snap │ ├── schema_derive_test__uint_non_strict_integers_format.snap │ ├── schema_derive_test__unit_struct_schema.snap │ ├── schema_generics__derive_generic_schema_collect_recursive_schema_not_inlined.snap │ ├── schema_generics__derive_generic_schema_enum_variants.snap │ ├── schema_generics__generic_request_body_schema.snap │ ├── schema_generics__generic_schema_full_api.snap │ ├── schema_generics__high_order_types.snap │ ├── schema_generics__rc_schema_high_order_types.snap │ ├── schema_generics__schema_with_non_generic_root.snap │ └── schema_generics__uuid_type_generic_argument.snap │ ├── testdata │ ├── description_override │ └── openapi-derive-info-description │ └── utoipa_gen_test.rs ├── utoipa-rapidoc ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── res │ └── rapidoc.html └── src │ └── lib.rs ├── utoipa-redoc ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── res │ └── redoc.html └── src │ ├── actix.rs │ ├── axum.rs │ ├── lib.rs │ └── rocket.rs ├── utoipa-scalar ├── CHANAGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── res │ └── scalar.html └── src │ ├── actix.rs │ ├── axum.rs │ ├── lib.rs │ └── rocket.rs ├── utoipa-swagger-ui-vendored ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── res │ └── v5.17.14.zip └── src │ └── lib.rs ├── utoipa-swagger-ui ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── build.rs └── src │ ├── actix.rs │ ├── axum.rs │ ├── lib.rs │ ├── oauth.rs │ └── rocket.rs └── utoipa ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md └── src ├── gen.rs ├── lib.rs ├── openapi.rs ├── openapi ├── content.rs ├── encoding.rs ├── example.rs ├── extensions.rs ├── external_docs.rs ├── header.rs ├── info.rs ├── link.rs ├── path.rs ├── request_body.rs ├── response.rs ├── schema.rs ├── security.rs ├── server.rs ├── snapshots │ ├── utoipa__openapi__request_body__openapi_extensions_tests__request_body_builder_ext.snap │ ├── utoipa__openapi__request_body__openapi_extensions_tests__request_body_ext.snap │ ├── utoipa__openapi__request_body__tests__request_body_builder.snap │ ├── utoipa__openapi__response__openapi_extensions_tests__response_builder_ext.snap │ ├── utoipa__openapi__response__openapi_extensions_tests__response_ext.snap │ └── utoipa__openapi__response__tests__response_builder.snap ├── tag.rs └── xml.rs └── snapshots ├── utoipa__openapi__tests__merge_2_openapi_documents.snap ├── utoipa__openapi__tests__merge_same_path_diff_methods.snap ├── utoipa__openapi__tests__nest_open_apis.snap ├── utoipa__openapi__tests__openapi_custom_extension.snap ├── utoipa__openapi__tests__serialize_openapi_json_minimal_success.snap └── utoipa__openapi__tests__serialize_openapi_json_with_paths_success.snap /.github/actions/gitlog/action.yaml: -------------------------------------------------------------------------------- 1 | name: Git log 2 | description: Mangles git log for change log 3 | inputs: 4 | output-file: 5 | description: File path where to place the content of the changed commits 6 | required: true 7 | crate: 8 | description: Name of the crate to get git log for 9 | required: true 10 | outputs: 11 | last_release: 12 | description: Last release commit or first commit of history 13 | value: ${{ steps.gitlog.outputs.last_release }} 14 | runs: 15 | using: composite 16 | steps: 17 | - shell: bash 18 | id: gitlog 19 | run: | 20 | ${{ github.action_path }}/gitlog.sh --output-file ${{ inputs.output-file }} --crate ${{ inputs.crate }} 21 | -------------------------------------------------------------------------------- /.github/actions/publish/action.yaml: -------------------------------------------------------------------------------- 1 | name: Publish crate 2 | description: Publishes crate to crates.io 3 | inputs: 4 | token: 5 | description: Cargo login token to use the publish the crate 6 | required: true 7 | ref: 8 | description: "Github release tag ref" 9 | required: true 10 | runs: 11 | using: composite 12 | steps: 13 | - shell: bash 14 | id: publish_crate 15 | run: | 16 | ${{ github.action_path }}/publish.sh --token ${{ inputs.token }} --ref ${{ inputs.ref }} 17 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | name: Publish release 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | env: 8 | CARGO_TERM_COLOR: always 9 | 10 | jobs: 11 | publish: 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 2 18 | 19 | - uses: ./.github/actions/publish 20 | name: Cargo publish 21 | with: 22 | token: ${{ secrets.CARGO_LOGIN }} 23 | ref: ${{ github.ref }} 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | Cargo.lock 3 | *.iml 4 | .idea 5 | .vscode 6 | target 7 | .nvim 8 | 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | Changelogs are kept separately for each create in this repository. 4 | 5 | * [utoipa changelog](./utoipa/CHANGELOG.md) 6 | * [utoipa-gen changelog](./utoipa-gen/CHANGELOG.md) 7 | * [utoipa-actix-web changelog](./utoipa-actix-web/CHANGELOG.md) 8 | * [utoipa-axum changelog](./utoipa-axum/CHANGELOG.md) 9 | * [utoipa-config changelog](./utoipa-config/CHANGELOG.md) 10 | * [utoipa-rapidoc changelog](./utoipa-rapidoc/CHANGELOG.md) 11 | * [utoipa-redoc changelog](./utoipa-redoc/CHANGELOG.md) 12 | * [utoipa-swagger-ui changelog](./utoipa-swagger-ui/CHANGELOG.md) 13 | * [utoipa-swagger-ui-vendored changelog](./utoipa-swagger-ui-vendored/CHANGELOG.md) 14 | 15 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace.package] 2 | rust-version = "1.75" 3 | 4 | [workspace] 5 | resolver = "2" 6 | members = [ 7 | "utoipa", 8 | "utoipa-gen", 9 | "utoipa-swagger-ui-vendored", 10 | "utoipa-swagger-ui", 11 | "utoipa-redoc", 12 | "utoipa-rapidoc", 13 | "utoipa-scalar", 14 | "utoipa-axum", 15 | "utoipa-config", 16 | "utoipa-actix-web", 17 | ] 18 | 19 | [workspace.metadata.publish] 20 | order = [ 21 | "utoipa-config", 22 | "utoipa-gen", 23 | "utoipa", 24 | "utoipa-swagger-ui-vendored", 25 | "utoipa-swagger-ui", 26 | "utoipa-redoc", 27 | "utoipa-rapidoc", 28 | "utoipa-scalar", 29 | "utoipa-axum", 30 | "utoipa-actix-web", 31 | ] 32 | -------------------------------------------------------------------------------- /examples/actix-web-multipart/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "actix-web-multipart" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | actix-web = "4" 8 | actix-multipart = "0.7" 9 | utoipa = { path = "../../utoipa", features = ["actix_extras"] } 10 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["actix-web"] } 11 | utoipa-actix-web = { path = "../../utoipa-actix-web" } 12 | 13 | [workspace] 14 | -------------------------------------------------------------------------------- /examples/actix-web-multipart/README.md: -------------------------------------------------------------------------------- 1 | # actix-web-multipart 2 | 3 | This example demonstrates actix-web with utoipa multipart file upload. Browse to `http://localhost:8080/swagger-ui/` to upload a file. 4 | 5 | Run with: 6 | ```bash 7 | cargo run 8 | ``` 9 | -------------------------------------------------------------------------------- /examples/actix-web-multiple-api-docs-with-scopes/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "actix-web-multiple-api-docs-with-scopes" 3 | description = "Simple actix-web with multiple scoped api docs" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | actix-web = "4" 15 | serde = { version = "1.0", features = ["derive"] } 16 | env_logger = "0.11.0" 17 | log = "0.4" 18 | futures = "0.3" 19 | utoipa = { path = "../../utoipa", features = ["actix_extras"] } 20 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["actix-web"] } 21 | 22 | [workspace] 23 | -------------------------------------------------------------------------------- /examples/actix-web-multiple-api-docs-with-scopes/README.md: -------------------------------------------------------------------------------- 1 | # actix-web-multiple-api-docs-with-scopes ~ utoipa with utoipa-swagger-ui example 2 | 3 | This is a demo `actix-web` application with multiple API docs with scope and context path. 4 | 5 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 6 | 7 | ```bash 8 | cargo run 9 | ``` 10 | 11 | On the Swagger-UI will be a drop-down labelled "Select a definition", containing "api1" and "api2". 12 | 13 | Alternatively, they can be loaded directly using 14 | 15 | - api1: http://localhost:8080/swagger-ui/?urls.primaryName=api1 16 | - api2: http://localhost:8080/swagger-ui/?urls.primaryName=api1 17 | 18 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 19 | 20 | ```bash 21 | RUST_LOG=debug cargo run 22 | ``` 23 | -------------------------------------------------------------------------------- /examples/actix-web-scopes-binding/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "actix-web-scopes-binding" 3 | description = "Simple actix-web demo to demonstrate utoipa-actix-web bidings with scopes" 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | actix-web = "4" 9 | serde = { version = "1.0", features = ["derive"] } 10 | env_logger = "0.11.0" 11 | log = "0.4" 12 | futures = "0.3" 13 | utoipa = { path = "../../utoipa", features = ["actix_extras"] } 14 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = [ 15 | "actix-web", 16 | ] } 17 | utoipa-actix-web = { path = "../../utoipa-actix-web" } 18 | 19 | [workspace] 20 | -------------------------------------------------------------------------------- /examples/actix-web-scopes-binding/README.md: -------------------------------------------------------------------------------- 1 | # actix-web-scopes-binding 2 | 3 | 4 | This is a demo `actix-web` application with [`utoipa-actix-web`][../../utoipa-actix-web] bindings demonstrating scopes support. 5 | 6 | Run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 7 | 8 | ```bash 9 | cargo run 10 | ``` 11 | 12 | Or with more logs 13 | ```bash 14 | RUST_LOG=debug cargo run 15 | ``` 16 | -------------------------------------------------------------------------------- /examples/axum-multipart/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axum-multipart" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | axum = { version = "0.8.0", features = ["multipart"] } 8 | tokio = { version = "1", features = ["full"] } 9 | tower = "0.5" 10 | utoipa = { path = "../../utoipa", features = ["axum_extras"] } 11 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["axum"] } 12 | utoipa-axum = { path = "../../utoipa-axum" } 13 | serde = { features = ["derive"], version = "1" } 14 | 15 | [workspace] 16 | -------------------------------------------------------------------------------- /examples/axum-multipart/README.md: -------------------------------------------------------------------------------- 1 | # axum-multipart 2 | 3 | This example demonstrates axum with utoipa multipart file upload. Browse to `http://localhost:8080/swagger-ui` to upload a file. 4 | 5 | Run with: 6 | ```bash 7 | cargo run 8 | ``` 9 | -------------------------------------------------------------------------------- /examples/axum-utoipa-bindings/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axum-utoipa-bindings" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | axum = "0.8.0" 8 | tokio = { version = "1", features = ["full"] } 9 | tower = "0.5" 10 | utoipa = { path = "../../utoipa", features = ["axum_extras", "debug"] } 11 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["axum"] } 12 | utoipa-axum = { path = "../../utoipa-axum" ,features = ["debug"] } 13 | serde = "1" 14 | 15 | [workspace] 16 | -------------------------------------------------------------------------------- /examples/axum-utoipa-bindings/README.md: -------------------------------------------------------------------------------- 1 | # utoipa with axum bindings 2 | 3 | This demo `axum` application demonstrates `utoipa` and `axum` seamless integration with `utoipa-axum` crate. 4 | API doc is served via Swagger UI. 5 | 6 | Run the app 7 | ```bash 8 | cargo run 9 | ``` 10 | 11 | Browse the API docs. 12 | ``` 13 | http://localhost:8080/swagger-ui 14 | ``` 15 | -------------------------------------------------------------------------------- /examples/axum-utoipa-docker: -------------------------------------------------------------------------------- 1 | ./axum-utoipa-nesting-vendored -------------------------------------------------------------------------------- /examples/axum-utoipa-nesting-vendored/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axum-utoipa-nesting" 3 | description = "Axum nesting example with Swagger UI" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = ["Elli Example "] 8 | 9 | 10 | [dependencies] 11 | axum = "0.8.0" 12 | hyper = { version = "1.0.1", features = ["full"] } 13 | tokio = { version = "1.17", features = ["full"] } 14 | tower = "0.5" 15 | utoipa = { path = "../../utoipa", features = ["axum_extras"] } 16 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["axum", "vendored"], default-features = false } 17 | serde = { version = "1.0", features = ["derive"] } 18 | env_logger = "0.11" 19 | log = "0.4" 20 | 21 | [workspace] 22 | -------------------------------------------------------------------------------- /examples/axum-utoipa-nesting-vendored/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.14 2 | 3 | COPY target/x86_64-unknown-linux-musl/release/axum-utoipa-nesting /axum-utoipa-nesting 4 | 5 | ENTRYPOINT [ "/axum-utoipa-nesting" ] 6 | -------------------------------------------------------------------------------- /examples/axum-utoipa-nesting-vendored/README.md: -------------------------------------------------------------------------------- 1 | # axum-nesting-vendored ~ utoipa with utoipa-swagger-ui example 2 | 3 | This example demonstrates `axum` with programmatic and macro based nesting of OpenApis 4 | using `utoipa-swagger-ui` for visualization. 5 | 6 | Example uses `utoipa-swagger-ui-vendored` to demonstrate vendored version of Swagger UI. 7 | 8 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 9 | 10 | ```bash 11 | cargo run 12 | ``` 13 | 14 | ## Run with Docker 15 | 16 | You have to build the crate with `--release` or set `debug-embed` in order to embed Swagger UI. 17 | ```bash 18 | cargo build --release --target x86_64-unknown-linux-musl 19 | docker build -t axum-utoipa-nesting:latest . 20 | docker run -p 8080:8080 -t axum-utoipa-nesting:latest 21 | ``` 22 | -------------------------------------------------------------------------------- /examples/generics-actix/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "generics-actix" 3 | description = "Simple actix-web using non-supported types and generics with utoipa and Swagger" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | actix-web = "4" 15 | env_logger = "0.10.0" 16 | geo-types = { version = "0.7", features = ["serde"] } 17 | serde = { version = "1.0", features = ["derive"] } 18 | utoipa = { path = "../../utoipa", features = ["actix_extras", "non_strict_integers"] } 19 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["actix-web"] } 20 | 21 | [workspace] 22 | -------------------------------------------------------------------------------- /examples/generics-actix/README.md: -------------------------------------------------------------------------------- 1 | # generics-actix 2 | 3 | This is demo `actix-web` application showing using external `geo-types`, which uses generics, in endpoints. 4 | The API demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 7 | 8 | ```bash 9 | cargo run 10 | ``` 11 | 12 | In the swagger UI: 13 | 14 | 1. Send `x=1`, `y=2` to endpoint `coord_u64` to see an integer `x`,`y` coord object returned. 15 | 2. Send `x=1.1`, `y=2.2` to endpoint `coord_f64` to see a float `x`,`y` coord object returned. 16 | 17 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 18 | 19 | ```bash 20 | RUST_LOG=debug cargo run 21 | ``` 22 | -------------------------------------------------------------------------------- /examples/raw-json-actix/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "raw-json-actix" 3 | description = "Simple actix-web using raw JSON with utoipa and Swagger" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | actix-web = "4" 15 | env_logger = "0.10.0" 16 | serde_json = "1.0" 17 | utoipa = { path = "../../utoipa", features = ["actix_extras"] } 18 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["actix-web"] } 19 | 20 | [workspace] 21 | -------------------------------------------------------------------------------- /examples/raw-json-actix/README.md: -------------------------------------------------------------------------------- 1 | # raw-json-actix 2 | 3 | This is a demo `actix-web` application showing using raw JSON in endpoints. 4 | The API demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 7 | 8 | ```bash 9 | cargo run 10 | ``` 11 | 12 | In the swagger UI: 13 | 14 | 1. Send body `"string"` and the console will show the body was a `serde_json::String`. 15 | 2. Send body `1` and the console will show the body was a `serde_json::Number`. 16 | 3. Send body `[1, 2]` and the console will show the body was a `serde_json::Array`. 17 | 18 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 19 | 20 | ```bash 21 | RUST_LOG=debug cargo run 22 | ``` 23 | -------------------------------------------------------------------------------- /examples/rocket-todo/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rocket-todo" 3 | description = "Simple rocket todo example api with utoipa and Swagger UI, Rapidoc, Redoc, and Scalar" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = ["Elli Example "] 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | rocket = { version = "0.5", features = ["json"] } 13 | utoipa = { path = "../../utoipa", features = ["rocket_extras"] } 14 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["rocket"] } 15 | utoipa-redoc = { path = "../../utoipa-redoc", features = ["rocket"] } 16 | utoipa-rapidoc = { path = "../../utoipa-rapidoc", features = ["rocket"] } 17 | utoipa-scalar = { path = "../../utoipa-scalar", features = ["rocket"] } 18 | serde = { version = "1.0", features = ["derive"] } 19 | serde_json = "1.0" 20 | log = "0.4" 21 | 22 | [workspace] 23 | -------------------------------------------------------------------------------- /examples/rocket-todo/README.md: -------------------------------------------------------------------------------- 1 | # todo-rocket ~ utoipa with utoipa-swagger-ui, utoipa-redoc and utoipa-rapidoc example 2 | 3 | This is a demo `rocket` application with in-memory storage to manage Todo items. The API 4 | demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 7 | 8 | Just run command below to run the demo application and browse to `http://localhost:8000/swagger-ui/`. 9 | 10 | If you prefer Redoc just head to `http://localhost:8000/redoc` and view the Open API. 11 | 12 | RapiDoc can be found from `http://localhost:8000/redoc`. 13 | 14 | Scalar can be reached on `http://localhost:8000/scalar`. 15 | 16 | ```bash 17 | cargo run 18 | ``` 19 | 20 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 21 | 22 | ```bash 23 | RUST_LOG=debug cargo run 24 | ``` 25 | -------------------------------------------------------------------------------- /examples/simple-axum/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "simple-axum" 3 | description = "Very short Axum example that exposes OpenAPI json file" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | axum = "0.8.0" 12 | tokio = { version = "1.17", features = ["full"] } 13 | utoipa = { path = "../../utoipa", features = ["axum_extras"] } 14 | 15 | [workspace] 16 | -------------------------------------------------------------------------------- /examples/simple-axum/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::net::SocketAddr; 2 | 3 | use axum::{routing::get, Json}; 4 | use utoipa::OpenApi; 5 | 6 | #[derive(OpenApi)] 7 | #[openapi(paths(openapi))] 8 | struct ApiDoc; 9 | 10 | /// Return JSON version of an OpenAPI schema 11 | #[utoipa::path( 12 | get, 13 | path = "/api-docs/openapi.json", 14 | responses( 15 | (status = 200, description = "JSON file", body = ()) 16 | ) 17 | )] 18 | async fn openapi() -> Json { 19 | Json(ApiDoc::openapi()) 20 | } 21 | 22 | #[tokio::main] 23 | async fn main() { 24 | let socket_address: SocketAddr = "127.0.0.1:8080".parse().unwrap(); 25 | let listener = tokio::net::TcpListener::bind(socket_address).await.unwrap(); 26 | 27 | let app = axum::Router::new().route("/api-docs/openapi.json", get(openapi)); 28 | 29 | axum::serve(listener, app.into_make_service()) 30 | .await 31 | .unwrap() 32 | } 33 | -------------------------------------------------------------------------------- /examples/simple-x-extensions/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "simple-x-extensions" 3 | description = "Demonstration of setting extensions via `utoipa::path` macro as well as using the `Modify` trait for comparison purposes." 4 | version = "0.1.0" 5 | edition = "2021" 6 | 7 | [dependencies] 8 | actix-web = "4" 9 | env_logger = "0" 10 | utoipa = { path = "../../utoipa", features = [ "yaml" ] } 11 | 12 | [workspace] 13 | -------------------------------------------------------------------------------- /examples/simple-x-extensions/README.md: -------------------------------------------------------------------------------- 1 | # simple-x-extensions ~ utoipa with extensions example 2 | 3 | This is a demo `actix-web` application that defines an OpenAPI with OpenAPI extensions. The extensions are set via the `utoipa::path` 4 | macro as well as using the `Modify` trait - for comparisons. 5 | 6 | Just run command below to run the demo application - a `actix-web` web server - and browse to `http://localhost:8080/openapi` to view the OpenAPI in yaml. 7 | 8 | ```bash 9 | cargo run 10 | ``` 11 | 12 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 13 | 14 | ```bash 15 | RUST_LOG=debug cargo run 16 | ``` 17 | -------------------------------------------------------------------------------- /examples/todo-actix/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-actix" 3 | description = "Simple actix-web todo example api with utoipa and Swagger UI, Rapidoc, Redoc, and Scalar" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = ["Example "] 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | actix-web = "4" 13 | serde = { version = "1.0", features = ["derive"] } 14 | env_logger = "0.11" 15 | log = "0.4" 16 | futures = "0.3" 17 | utoipa = { path = "../../utoipa", features = ["actix_extras"] } 18 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = [ 19 | "actix-web", 20 | ] } 21 | utoipa-redoc = { path = "../../utoipa-redoc", features = ["actix-web"] } 22 | utoipa-rapidoc = { path = "../../utoipa-rapidoc", features = ["actix-web"] } 23 | utoipa-scalar = { path = "../../utoipa-scalar", features = ["actix-web"] } 24 | utoipa-actix-web = { path = "../../utoipa-actix-web" } 25 | 26 | [workspace] 27 | -------------------------------------------------------------------------------- /examples/todo-actix/README.md: -------------------------------------------------------------------------------- 1 | # todo-actix ~ utoipa with utoipa-swagger-ui, utoipa-redoc and utoipa-rapidoc example 2 | 3 | This is a demo `actix-web` application with in-memory storage to manage Todo items. The API 4 | demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 7 | 8 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 9 | 10 | If you prefer Redoc just head to `http://localhost:8080/redoc` and view the Open API. 11 | 12 | RapiDoc can be found from `http://localhost:8080/rapidoc`. 13 | 14 | Scalar can be reached on `http://localhost:8080/scalar`. 15 | 16 | ```bash 17 | cargo run 18 | ``` 19 | 20 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 21 | 22 | ```bash 23 | RUST_LOG=debug cargo run 24 | ``` 25 | -------------------------------------------------------------------------------- /examples/todo-axum/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-axum" 3 | description = "Simple axum todo example api with utoipa and Swagger UI, Rapidoc, Redoc, and Scalar" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = ["Elli Example "] 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | axum = "0.8.0" 13 | hyper = { version = "1.0.1", features = ["full"] } 14 | tokio = { version = "1.17", features = ["full"] } 15 | tower = "0.5" 16 | utoipa = { path = "../../utoipa", features = ["axum_extras"] } 17 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui", features = ["axum"] } 18 | utoipa-axum = { path = "../../utoipa-axum" } 19 | utoipa-redoc = { path = "../../utoipa-redoc", features = ["axum"] } 20 | utoipa-rapidoc = { path = "../../utoipa-rapidoc", features = ["axum"] } 21 | utoipa-scalar = { path = "../../utoipa-scalar", features = ["axum"] } 22 | serde = { version = "1.0", features = ["derive"] } 23 | 24 | [workspace] 25 | -------------------------------------------------------------------------------- /examples/todo-axum/README.md: -------------------------------------------------------------------------------- 1 | # todo-axum ~ utoipa with utoipa-swagger-ui, utoipa-redoc and utoipa-rapidoc example 2 | 3 | This is a demo `axum` application with in-memory storage to manage Todo items. The API 4 | demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 7 | 8 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 9 | 10 | If you prefer Redoc just head to `http://localhost:8080/redoc` and view the Open API. 11 | 12 | RapiDoc can be found from `http://localhost:8080/rapidoc`. 13 | 14 | Scalar can be reached on `http://localhost:8080/scalar`. 15 | 16 | ```bash 17 | cargo run 18 | ``` 19 | -------------------------------------------------------------------------------- /examples/todo-tide/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-tide" 3 | description = "Simple tide todo example api with utoipa and Swagger UI" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Elli Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | tide = "0.16.0" 15 | async-std = { version = "1.8.0", features = ["attributes"] } 16 | serde = { version = "1.0", features = ["derive"] } 17 | serde_json = "1.0" 18 | env_logger = "0.11.0" 19 | log = "0.4" 20 | futures = "0.3" 21 | utoipa = { path = "../../utoipa" } 22 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui" } 23 | 24 | [workspace] 25 | -------------------------------------------------------------------------------- /examples/todo-tide/README.md: -------------------------------------------------------------------------------- 1 | # todo-tide ~ utoipa with utoipa-swagger-ui example 2 | 3 | This is a demo `tide` application with in-memory storage to manage Todo items. The API 4 | demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 7 | 8 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/index.html`. 9 | 10 | ```bash 11 | cargo run 12 | ``` 13 | 14 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 15 | 16 | ```bash 17 | RUST_LOG=debug cargo run 18 | ``` 19 | -------------------------------------------------------------------------------- /examples/todo-warp-rapidoc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-warp-rapidoc" 3 | description = "Simple warp todo example api with utoipa and utoipa-rapidoc" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Elli Example " 9 | ] 10 | 11 | [dependencies] 12 | tokio = { version = "1", features = ["full"] } 13 | warp = "0.3" 14 | serde = { version = "1.0", features = ["derive"] } 15 | env_logger = "0.11.0" 16 | log = "0.4" 17 | futures = "0.3" 18 | utoipa = { path = "../../utoipa" } 19 | utoipa-rapidoc = { path = "../../utoipa-rapidoc" } 20 | 21 | [workspace] 22 | 23 | -------------------------------------------------------------------------------- /examples/todo-warp-rapidoc/README.md: -------------------------------------------------------------------------------- 1 | # warp with utoipa-rapidoc 2 | 3 | This is simple Todo app example with warp and utoipa-rapidoc OpenAPI viewer. 4 | 5 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 6 | 7 | Head to `http://localhost:8080/rapidoc` for the demo. 8 | 9 | run 10 | ```rust 11 | RUST_LOG=debug cargo run 12 | ``` 13 | -------------------------------------------------------------------------------- /examples/todo-warp-redoc-with-file-config/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-warp-redoc-with-file-config" 3 | description = "Simple warp todo example api with utoipa and utoipa-redoc" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = ["Elli Example "] 8 | 9 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 10 | 11 | [dependencies] 12 | tokio = { version = "1", features = ["full"] } 13 | warp = "0.3" 14 | serde = { version = "1.0", features = ["derive"] } 15 | env_logger = "0.11.0" 16 | log = "0.4" 17 | futures = "0.3" 18 | utoipa = { path = "../../utoipa" } 19 | utoipa-redoc = { path = "../../utoipa-redoc" } 20 | 21 | [workspace] 22 | -------------------------------------------------------------------------------- /examples/todo-warp-redoc-with-file-config/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("cargo:rustc-env=UTOIPA_REDOC_CONFIG_FILE=redoc.json") 3 | } 4 | -------------------------------------------------------------------------------- /examples/todo-warp-redoc-with-file-config/redoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "disableSearch": true 3 | } 4 | -------------------------------------------------------------------------------- /examples/todo-warp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "todo-warp" 3 | description = "Simple warp todo example api with utoipa and utoipa-swagger-ui" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Elli Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | tokio = { version = "1", features = ["full"] } 15 | warp = "0.3" 16 | serde = { version = "1.0", features = ["derive"] } 17 | env_logger = "0.11.0" 18 | log = "0.4" 19 | futures = "0.3" 20 | utoipa = { path = "../../utoipa" } 21 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui" } 22 | 23 | [workspace] 24 | -------------------------------------------------------------------------------- /examples/todo-warp/README.md: -------------------------------------------------------------------------------- 1 | # todo-warp ~ utoipa with utoipa-swagger-ui example 2 | 3 | This is a demo `warp` application with in-memory storage to manage Todo items. 4 | The API demonstrates `utoipa` with `utoipa-swagger-ui` functionalities. 5 | 6 | This example is more bare minimum compared to `todo-actix`, since similarly same macro syntax is 7 | supported, no matter the framework. 8 | 9 | Purpose of this `warp` demo is to mainly demonstrate how `utoipa` and `utoipa-swagger-ui` can be integrated 10 | with other frameworks as well. 11 | 12 | For security restricted endpoints the super secret API key is: `utoipa-rocks`. 13 | 14 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 15 | 16 | ```bash 17 | cargo run 18 | ``` 19 | 20 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 21 | 22 | ```bash 23 | RUST_LOG=debug cargo run 24 | ``` 25 | -------------------------------------------------------------------------------- /examples/utoipa-config-test/README.md: -------------------------------------------------------------------------------- 1 | # utoipa-config-test 2 | 3 | This example demonstrates global Rust type aliases in utoipa project. 4 | Check out `main.rs` and `build.rs` and then run `cargo run`. 5 | 6 | Browse the [project files here](../../utoipa-config/config-test-crate/). 7 | -------------------------------------------------------------------------------- /examples/warp-multiple-api-docs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "warp-multiple-api-docs" 3 | description = "Simple warp example api with multiple api docs" 4 | version = "0.1.0" 5 | edition = "2021" 6 | license = "MIT" 7 | authors = [ 8 | "Elli Example " 9 | ] 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [dependencies] 14 | tokio = { version = "1", features = ["full"] } 15 | warp = "0.3" 16 | serde = { version = "1.0", features = ["derive"] } 17 | env_logger = "0.10.0" 18 | log = "0.4" 19 | futures = "0.3" 20 | utoipa = { path = "../../utoipa" } 21 | utoipa-swagger-ui = { path = "../../utoipa-swagger-ui" } 22 | 23 | [workspace] 24 | -------------------------------------------------------------------------------- /examples/warp-multiple-api-docs/README.md: -------------------------------------------------------------------------------- 1 | # warp-multiple-api-docs ~ utoipa with utoipa-swagger-ui example 2 | 3 | This is a demo `warp` application with multiple API docs to demonstrate splitting APIs with `utoipa` and `utoipa-swagger-ui`. 4 | 5 | Just run command below to run the demo application and browse to `http://localhost:8080/swagger-ui/`. 6 | 7 | ```bash 8 | cargo run 9 | ``` 10 | 11 | On the Swagger-UI will be a drop-down labelled "Select a definition", containing `/api-doc1.json` and `/api-doc2.json`. 12 | 13 | Alternatively, they can be loaded directly using 14 | 15 | - api1: http://localhost:8080/swagger-ui/?urls.primaryName=%2Fapi-doc1.json 16 | - api2: http://localhost:8080/swagger-ui/?urls.primaryName=%2Fapi-doc2.json 17 | 18 | If you want to see some logging, you may prepend the command with `RUST_LOG=debug` as shown below. 19 | 20 | ```bash 21 | RUST_LOG=debug cargo run 22 | ``` 23 | -------------------------------------------------------------------------------- /scripts/coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if ! which grcov; then 4 | echo "Error: grcov not found. Try |cargo install grcov|" 5 | exit 1 6 | fi 7 | 8 | export RUSTFLAGS="-Zprofile -Clink-dead-code -Ccodegen-units=1 -Cinline-threshold=0 -Copt-level=0 -Coverflow-checks=off $RUSTFLAGS" 9 | export CARGO_INCREMENTAL=0 10 | export RUST_BACKTRACE=1 11 | export RUST_MIN_STACK=8388608 12 | 13 | rm -rf target/cov 14 | 15 | cargo +nightly test 16 | 17 | grcov . -s . --binary-path target/debug/ -t html --branch --ignore-not-existing -o target/cov/ 18 | -------------------------------------------------------------------------------- /scripts/doc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Generate utoipa workspace docs 4 | 5 | cargo +nightly doc -Z unstable-options --workspace --no-deps \ 6 | --features actix_extras,openapi_extensions,yaml,uuid,ulid,url,non_strict_integers,actix-web,axum,rocket,macros,config \ 7 | --config 'build.rustdocflags = ["--cfg", "doc_cfg"]' 8 | -------------------------------------------------------------------------------- /scripts/update-swagger-ui.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Update Swagger UI version 4 | 5 | set -eu -o pipefail 6 | 7 | version="${1:-""}" 8 | if [ -z "$version" ]; then 9 | echo "Missing 'version' argument from command, run as $0 " >&2 && exit 1 10 | fi 11 | zip_name="v$version.zip" 12 | 13 | curl -sSL -o "$zip_name" "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v$version.zip" 14 | 15 | echo "Update vendored Swagger UI" 16 | mv "$zip_name" ./utoipa-swagger-ui-vendored/res/ 17 | sed -i "s|version: \`.*\`|version: \`$version\`|" ./utoipa-swagger-ui-vendored/README.md 18 | sed -i "s|version: \`.*\`|version: \`$version\`|" ./utoipa-swagger-ui-vendored/src/lib.rs 19 | sed -i "s|res/v.*\.zip|res/v$version.zip|" ./utoipa-swagger-ui-vendored/src/lib.rs 20 | 21 | echo "Update utoipa-swagger-ui Swagger UI version" 22 | sed -i "s|tags/v.*>|tags/v$version.zip>|" ./utoipa-swagger-ui/README.md 23 | sed -i "s|tags/v.*>|tags/v$version.zip>|" ./utoipa-swagger-ui/src/lib.rs 24 | sed -i "s|tags/v.*\.zip|tags/v$version.zip|" ./utoipa-swagger-ui/build.rs 25 | -------------------------------------------------------------------------------- /scripts/validate-examples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | : "${CARGO:=cargo}" 6 | 7 | # Finds examples in the `./examples` directory. This query will also automatically 8 | # ignore directories that are not Rust projects (i.e. those that don't contain Cargo.toml). 9 | EXAMPLES=$(find ./examples/ -maxdepth 1 -mindepth 1 -type d -exec test -e "{}/Cargo.toml" ";" -print) 10 | 11 | 12 | for example in $EXAMPLES 13 | do 14 | echo "Checking example: $example..." 15 | 16 | pushd $example 17 | 18 | $CARGO fmt --check 19 | echo " -> example is properly formatted (passes cargo fmt)" 20 | $CARGO clippy --all-features --all-targets --workspace --quiet 21 | echo " -> example compiles (passes cargo clippy)" 22 | 23 | popd 24 | done 25 | 26 | echo "All examples are valid!" 27 | -------------------------------------------------------------------------------- /utoipa-actix-web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog - utoipa-actix-web 2 | 3 | ## 0.1.2 - Nov 8 2024 4 | 5 | ### Added 6 | 7 | * Add passthrough for `Scope::wrap` (https://github.com/juhaku/utoipa/pull/1196) 8 | 9 | ## 0.1.1 - Oct 30 2024 10 | 11 | ### Changed 12 | 13 | * Add `map` support for `ServiceConfig` (https://github.com/juhaku/utoipa/pull/1174) 14 | 15 | ## 0.1.0 - Oct 23 2024 16 | 17 | ### Added 18 | 19 | * Add implementation for utoipa-actix-web bindings (https://github.com/juhaku/utoipa/pull/1158) 20 | 21 | ### Changed 22 | 23 | * Finalize actix-web utoipa bindings (https://github.com/juhaku/utoipa/pull/1160) 24 | -------------------------------------------------------------------------------- /utoipa-actix-web/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "utoipa-actix-web" 3 | description = "Utoipa's actix-web bindings for seamless integration of the two" 4 | version = "0.1.2" 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | readme = "README.md" 8 | keywords = ["utoipa", "actix-web", "bindings"] 9 | repository = "https://github.com/juhaku/utoipa" 10 | categories = ["web-programming"] 11 | authors = ["Juha Kukkonen "] 12 | rust-version.workspace = true 13 | 14 | [dependencies] 15 | utoipa = { path = "../utoipa", version = "5" } 16 | actix-web = { version = "4", default-features = false } 17 | actix-service = "2" 18 | 19 | [dev-dependencies] 20 | utoipa = { path = "../utoipa", version = "5", features = [ 21 | "actix_extras", 22 | "macros", 23 | "debug", 24 | ] } 25 | actix-web = { version = "4", default-features = false, features = ["macros"] } 26 | serde = "1" 27 | 28 | [package.metadata.docs.rs] 29 | features = [] 30 | rustdoc-args = ["--cfg", "doc_cfg"] 31 | 32 | [lints.rust] 33 | unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] } 34 | -------------------------------------------------------------------------------- /utoipa-actix-web/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-actix-web/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-axum/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-axum/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-axum/src/snapshots/utoipa_axum__tests__axum_router.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-axum/src/lib.rs 3 | expression: openapi 4 | snapshot_kind: text 5 | --- 6 | { 7 | "openapi": "3.1.0", 8 | "info": { 9 | "title": "", 10 | "version": "" 11 | }, 12 | "paths": { 13 | "/pet/{pet_id}": { 14 | "get": { 15 | "operationId": "get_pet_by_id", 16 | "parameters": [ 17 | { 18 | "name": "pet_id", 19 | "in": "path", 20 | "description": "ID of pet to return", 21 | "required": true, 22 | "schema": { 23 | "type": "integer", 24 | "format": "int32", 25 | "minimum": 0 26 | } 27 | } 28 | ], 29 | "responses": {} 30 | } 31 | } 32 | }, 33 | "components": {} 34 | } 35 | -------------------------------------------------------------------------------- /utoipa-config/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog - utoipa-config 2 | 3 | ## 0.1.2 - Oct 23 2024 4 | 5 | ### Changed 6 | 7 | * Added warning message to docs 8 | 9 | ## 0.1.1 - Oct 16 2024 10 | 11 | ### Fixed 12 | 13 | * Fix utoipa-config docs crate name 14 | 15 | ## 0.1.0 - Oct 14 2024 16 | 17 | ### Added 18 | 19 | * Add global config for `utiopa` (https://github.com/juhaku/utoipa/pull/1048) 20 | 21 | ### Fixed 22 | 23 | * Fix generic aliases (https://github.com/juhaku/utoipa/pull/1083) 24 | 25 | ### Changed 26 | 27 | * Chore enhance generic schema collection (https://github.com/juhaku/utoipa/pull/1116) 28 | * Add test for aliases on enum variant values 29 | * Fixed broken tests at `utoipa-config` 30 | * Remove commit commit id from changelogs (https://github.com/juhaku/utoipa/pull/1077) 31 | * Update to rc version 32 | * Update README.md 33 | 34 | -------------------------------------------------------------------------------- /utoipa-config/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "utoipa-config" 3 | description = "Config for controlling utoipa's various aspects" 4 | version = "0.1.2" 5 | edition = "2021" 6 | license = "MIT OR Apache-2.0" 7 | readme = "README.md" 8 | keywords = ["utoipa", "config", "utoipa-gen", "openapi", "auto-generate"] 9 | repository = "https://github.com/juhaku/utoipa" 10 | categories = ["web-programming"] 11 | authors = ["Juha Kukkonen "] 12 | rust-version.workspace = true 13 | 14 | [dependencies] 15 | serde = { version = "1.0", features = ["derive"] } 16 | serde_json = { version = "1.0" } 17 | 18 | [package.metadata.docs.rs] 19 | features = [] 20 | rustdoc-args = ["--cfg", "doc_cfg"] 21 | 22 | [lints.rust] 23 | unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_cfg)'] } 24 | -------------------------------------------------------------------------------- /utoipa-config/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-config/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-config/config-test-crate/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "utoipa-config-test" 3 | version = "0.1.0" 4 | edition = "2021" 5 | rust-version = "1.75" 6 | 7 | [dependencies] 8 | utoipa = { version = "5.0.0", path = "../../utoipa", features = [ 9 | "debug", 10 | "config", 11 | ] } 12 | serde = "1" 13 | serde_json = "1" 14 | 15 | [build-dependencies] 16 | utoipa-config = { version = "0.1", path = "../../utoipa-config" } 17 | 18 | [dev-dependencies] 19 | utoipa-config = { version = "0.1", path = "../../utoipa-config" } 20 | 21 | [workspace] 22 | -------------------------------------------------------------------------------- /utoipa-config/config-test-crate/README.md: -------------------------------------------------------------------------------- 1 | # utoipa-config-test 2 | 3 | This example demonstrates global Rust type aliases in utoipa project. 4 | Check out `main.rs` and `build.rs` and then run `cargo run`. 5 | -------------------------------------------------------------------------------- /utoipa-config/config-test-crate/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | utoipa_config::Config::new() 3 | .alias_for("MyType", "bool") 4 | .alias_for("MyInt", "Option") 5 | .alias_for("MyValue", "str") 6 | .alias_for("MyDateTime", "String") 7 | .alias_for("EntryAlias", "Entry") 8 | .alias_for("EntryString", "Entry") 9 | .write_to_file() 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-config/config-test-crate/src/main.rs: -------------------------------------------------------------------------------- 1 | use utoipa::ToSchema; 2 | 3 | #[allow(unused)] 4 | #[derive(ToSchema)] 5 | struct AliasValues { 6 | name: String, 7 | 8 | #[schema(value_type = MyType)] 9 | my_type: String, 10 | 11 | #[schema(value_type = MyInt)] 12 | my_int: String, 13 | 14 | #[schema(value_type = MyValue)] 15 | my_value: bool, 16 | 17 | date: MyDateTime, 18 | 19 | optional_date: Option, 20 | } 21 | 22 | #[allow(unused)] 23 | struct MyDateTime { 24 | millis: usize, 25 | } 26 | 27 | fn main() { 28 | let schema = utoipa::schema!( 29 | #[inline] 30 | AliasValues 31 | ); 32 | 33 | println!( 34 | "{}", 35 | serde_json::to_string_pretty(&schema).expect("schema must be JSON serializable") 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /utoipa-gen/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-gen/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-gen/README.md: -------------------------------------------------------------------------------- 1 | ../README.md -------------------------------------------------------------------------------- /utoipa-gen/src/ext/auto_types.rs: -------------------------------------------------------------------------------- 1 | use syn::{ItemFn, TypePath}; 2 | 3 | pub fn parse_fn_operation_responses(fn_op: &ItemFn) -> Option<&TypePath> { 4 | match &fn_op.sig.output { 5 | syn::ReturnType::Type(_, item) => get_type_path(item.as_ref()), 6 | syn::ReturnType::Default => None, // default return type () should result no responses 7 | } 8 | } 9 | 10 | fn get_type_path(ty: &syn::Type) -> Option<&TypePath> { 11 | match ty { 12 | syn::Type::Path(ty_path) => Some(ty_path), 13 | _ => None, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/src/path/handler.rs: -------------------------------------------------------------------------------- 1 | use quote::quote; 2 | use syn::ItemFn; 3 | 4 | use crate::{as_tokens_or_diagnostics, ToTokensDiagnostics}; 5 | 6 | use super::Path; 7 | 8 | pub struct Handler<'p> { 9 | pub path: Path<'p>, 10 | pub handler_fn: &'p ItemFn, 11 | } 12 | 13 | impl<'p> ToTokensDiagnostics for Handler<'p> { 14 | fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) -> Result<(), crate::Diagnostics> { 15 | let ast_fn = &self.handler_fn; 16 | let path = as_tokens_or_diagnostics!(&self.path); 17 | tokens.extend(quote! { 18 | #path 19 | #ast_fn 20 | }); 21 | 22 | Ok(()) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /utoipa-gen/src/snapshots/doctest_lib_rs__schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/src/lib.rs 3 | expression: "&schema" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "type": "array", 8 | "items": { 9 | "type": "object", 10 | "required": [ 11 | "id", 12 | "name" 13 | ], 14 | "properties": { 15 | "id": { 16 | "type": "integer", 17 | "format": "int32" 18 | }, 19 | "name": { 20 | "type": "string" 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_generic_openapi_component_schemas.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: schemas 4 | snapshot_kind: text 5 | --- 6 | { 7 | "schemas": { 8 | "dto.page.Response_dto.get.unit.Response": { 9 | "properties": { 10 | "list": { 11 | "items": { 12 | "$ref": "#/components/schemas/dto.get.unit.Response" 13 | }, 14 | "type": "array" 15 | }, 16 | "num": { 17 | "format": "int64", 18 | "minimum": 0, 19 | "type": "integer" 20 | }, 21 | "size": { 22 | "format": "int64", 23 | "minimum": 0, 24 | "type": "integer" 25 | }, 26 | "total": { 27 | "format": "int64", 28 | "minimum": 0, 29 | "type": "integer" 30 | } 31 | }, 32 | "required": [ 33 | "list", 34 | "num", 35 | "size", 36 | "total" 37 | ], 38 | "type": "object" 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_logical_or_security_requirement.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: security 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "oauth": [ 9 | "a" 10 | ] 11 | }, 12 | { 13 | "oauth": [ 14 | "b" 15 | ] 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_custom_info.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: info 4 | snapshot_kind: text 5 | --- 6 | { 7 | "contact": { 8 | "name": "Test" 9 | }, 10 | "description": "description override", 11 | "license": { 12 | "identifier": "MIT OR Apache-2.0", 13 | "name": "MIT OR Apache-2.0" 14 | }, 15 | "termsOfService": "http://localhost/terms", 16 | "title": "title override", 17 | "version": "1.0.0" 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_generic_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: response 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "properties": { 11 | "value": { 12 | "type": "string" 13 | } 14 | }, 15 | "required": [ 16 | "value" 17 | ], 18 | "type": "object" 19 | } 20 | } 21 | }, 22 | "description": "" 23 | } 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_generic_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: schema 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "value": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "value" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_generic_schema_with_as.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: schema 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "value": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "value" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_include_str_description.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: info 4 | snapshot_kind: text 5 | --- 6 | { 7 | "contact": { 8 | "name": "Test" 9 | }, 10 | "description": "this is include description\n", 11 | "license": { 12 | "identifier": "MIT OR Apache-2.0", 13 | "name": "MIT OR Apache-2.0" 14 | }, 15 | "title": "title override", 16 | "version": "static" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_licence.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: info 4 | snapshot_kind: text 5 | --- 6 | { 7 | "identifier": "MIT", 8 | "name": "licence_name" 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "MyResponse": { 8 | "description": "Ok" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__derive_openapi_with_servers.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: servers 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "this is description", 9 | "url": "http://localhost:8989" 10 | }, 11 | { 12 | "description": "remote api", 13 | "url": "http://api.{username}:{port}", 14 | "variables": { 15 | "port": { 16 | "default": "8080", 17 | "description": "Supported ports for the API", 18 | "enum": [ 19 | "8080", 20 | "5000", 21 | "3030" 22 | ] 23 | }, 24 | "username": { 25 | "default": "demo", 26 | "description": "Default username for API" 27 | } 28 | } 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/openapi_derive__openapi_schemas_resolve_generic_enum_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/openapi_derive.rs 3 | expression: schemas 4 | snapshot_kind: text 5 | --- 6 | { 7 | "Element_String": { 8 | "oneOf": [ 9 | { 10 | "properties": { 11 | "One": { 12 | "type": "string" 13 | } 14 | }, 15 | "required": [ 16 | "One" 17 | ], 18 | "type": "object" 19 | }, 20 | { 21 | "properties": { 22 | "Many": { 23 | "items": { 24 | "type": "string" 25 | }, 26 | "type": "array" 27 | } 28 | }, 29 | "required": [ 30 | "Many" 31 | ], 32 | "type": "object" 33 | } 34 | ] 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__arbitrary_expr_in_operation_id.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: operation_id 4 | snapshot_kind: text 5 | --- 6 | "8" 7 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_images_as_application_octet_stream.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&request_body" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "image/jpg": {}, 9 | "image/png": {} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_img_png_request_body.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&request_body" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "image/png": { 9 | "schema": { 10 | "contentEncoding": "base64", 11 | "type": "string" 12 | } 13 | } 14 | }, 15 | "required": true 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_required.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | }, 15 | { 16 | "in": "query", 17 | "name": "name2", 18 | "required": false, 19 | "schema": { 20 | "type": "string" 21 | } 22 | }, 23 | { 24 | "in": "query", 25 | "name": "name3", 26 | "required": true, 27 | "schema": { 28 | "type": "string" 29 | } 30 | } 31 | ] 32 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_with_ignored_eq_false_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | }, 15 | { 16 | "in": "query", 17 | "name": "__this_is_private", 18 | "required": true, 19 | "schema": { 20 | "type": "string" 21 | } 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_with_ignored_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_with_serde_skip.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | }, 15 | { 16 | "in": "query", 17 | "name": "name2", 18 | "required": false, 19 | "schema": { 20 | "type": "string" 21 | } 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_with_serde_skip_deserializing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | }, 15 | { 16 | "in": "query", 17 | "name": "name2", 18 | "required": false, 19 | "schema": { 20 | "type": "string" 21 | } 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_into_params_with_serde_skip_serializing.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | }, 15 | { 16 | "in": "query", 17 | "name": "name2", 18 | "required": false, 19 | "schema": { 20 | "type": "string" 21 | } 22 | } 23 | ] 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_multipart_form_data.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&request_body" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "multipart/form-data": { 9 | "schema": { 10 | "properties": { 11 | "file_bytes": { 12 | "contentMediaType": "application/octet-stream", 13 | "items": { 14 | "format": "int32", 15 | "minimum": 0, 16 | "type": "integer" 17 | }, 18 | "type": "array" 19 | }, 20 | "order_id": { 21 | "format": "int32", 22 | "type": "integer" 23 | } 24 | }, 25 | "required": [ 26 | "order_id", 27 | "file_bytes" 28 | ], 29 | "type": "object" 30 | } 31 | } 32 | }, 33 | "required": true 34 | } 35 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_octet_stream_request_body.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&request_body" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/octet-stream": { 9 | "schema": { 10 | "items": { 11 | "format": "int32", 12 | "minimum": 0, 13 | "type": "integer" 14 | }, 15 | "type": "array" 16 | } 17 | } 18 | }, 19 | "required": true 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_include_str_description.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&operation" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description from include_str!\n", 8 | "operationId": "test_description_summary", 9 | "responses": { 10 | "200": { 11 | "description": "success response" 12 | } 13 | }, 14 | "tags": [] 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_parameters_container_level_default.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "vec_default", 10 | "required": false, 11 | "schema": { 12 | "items": { 13 | "type": "string" 14 | }, 15 | "type": "array" 16 | } 17 | }, 18 | { 19 | "in": "query", 20 | "name": "string", 21 | "required": false, 22 | "schema": { 23 | "type": "string" 24 | } 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_always_required.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "value", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_custom_rename_all.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "vecDefault", 10 | "required": false, 11 | "schema": { 12 | "items": { 13 | "type": "string" 14 | }, 15 | "type": "array" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_custom_rename_all_serde_will_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "VEC_DEFAULT", 10 | "required": false, 11 | "schema": { 12 | "items": { 13 | "type": "string" 14 | }, 15 | "type": "array" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_into_params_with_raw_identifier.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "in", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_into_params_with_unit_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "in", 10 | "required": true, 11 | "schema": { 12 | "default": null 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_map.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "with_ref", 10 | "required": true, 11 | "schema": { 12 | "additionalProperties": { 13 | "$ref": "#/components/schemas/Foo" 14 | }, 15 | "propertyNames": { 16 | "type": "string" 17 | }, 18 | "type": "object" 19 | } 20 | }, 21 | { 22 | "in": "path", 23 | "name": "with_type", 24 | "required": true, 25 | "schema": { 26 | "additionalProperties": { 27 | "type": "string" 28 | }, 29 | "propertyNames": { 30 | "type": "string" 31 | }, 32 | "type": "object" 33 | } 34 | } 35 | ] 36 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_with_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "example": { 9 | "key": "value" 10 | }, 11 | "in": "path", 12 | "name": "map", 13 | "required": true, 14 | "schema": { 15 | "additionalProperties": { 16 | "type": "string" 17 | }, 18 | "propertyNames": { 19 | "type": "string" 20 | }, 21 | "type": "object" 22 | } 23 | }, 24 | { 25 | "example": [ 26 | "value1", 27 | "value2" 28 | ], 29 | "in": "path", 30 | "name": "vec", 31 | "required": true, 32 | "schema": { 33 | "items": { 34 | "type": "string" 35 | }, 36 | "type": "array" 37 | } 38 | } 39 | ] 40 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_params_with_serde_and_custom_rename.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "vecDefault", 10 | "required": false, 11 | "schema": { 12 | "items": { 13 | "type": "string" 14 | }, 15 | "type": "array" 16 | } 17 | }, 18 | { 19 | "in": "query", 20 | "name": "STRING", 21 | "required": false, 22 | "schema": { 23 | "type": "string" 24 | } 25 | }, 26 | { 27 | "in": "query", 28 | "name": "VEC", 29 | "required": false, 30 | "schema": { 31 | "items": { 32 | "type": "string" 33 | }, 34 | "type": "array" 35 | } 36 | }, 37 | { 38 | "in": "query", 39 | "name": "string_r2", 40 | "required": false, 41 | "schema": { 42 | "type": "string" 43 | } 44 | }, 45 | { 46 | "in": "query", 47 | "name": "string", 48 | "required": true, 49 | "schema": { 50 | "type": "string" 51 | } 52 | } 53 | ] 54 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_query_params_with_schema_features.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "value", 10 | "required": false, 11 | "schema": { 12 | "default": "value", 13 | "readOnly": true, 14 | "type": [ 15 | "string", 16 | "null" 17 | ], 18 | "writeOnly": true, 19 | "xml": { 20 | "name": "xml_value" 21 | } 22 | } 23 | }, 24 | { 25 | "in": "query", 26 | "name": "int", 27 | "required": true, 28 | "schema": { 29 | "format": "binary", 30 | "type": "string" 31 | } 32 | } 33 | ] 34 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_test_collect_request_body.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&schemas" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "Account": { 8 | "properties": { 9 | "id": { 10 | "format": "int32", 11 | "type": "integer" 12 | } 13 | }, 14 | "required": [ 15 | "id" 16 | ], 17 | "type": "object" 18 | }, 19 | "Person": { 20 | "properties": { 21 | "account": { 22 | "$ref": "#/components/schemas/Account" 23 | }, 24 | "name": { 25 | "type": "string" 26 | } 27 | }, 28 | "required": [ 29 | "name", 30 | "account" 31 | ], 32 | "type": "object" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_test_do_not_collect_inlined_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&schemas" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "Account": { 8 | "properties": { 9 | "id": { 10 | "format": "int32", 11 | "type": "integer" 12 | } 13 | }, 14 | "required": [ 15 | "id" 16 | ], 17 | "type": "object" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_test_do_not_collect_recursive_inlined.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "account": { 9 | "properties": { 10 | "id": { 11 | "format": "int32", 12 | "type": "integer" 13 | } 14 | }, 15 | "required": [ 16 | "id" 17 | ], 18 | "type": "object" 19 | }, 20 | "name": { 21 | "type": "string" 22 | } 23 | }, 24 | "required": [ 25 | "name", 26 | "account" 27 | ], 28 | "type": "object" 29 | } 30 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_datetime_format_path_parameter.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Foo database id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int64", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "description": "Datetime since foo is updated", 19 | "in": "query", 20 | "name": "start", 21 | "required": true, 22 | "schema": { 23 | "format": "date-time", 24 | "type": "string" 25 | } 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_datetime_format_query_parameter.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Foo database id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int64", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "description": "Datetime since foo is updated", 19 | "in": "path", 20 | "name": "start", 21 | "required": true, 22 | "schema": { 23 | "format": "date-time", 24 | "type": "string" 25 | } 26 | } 27 | ] 28 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_description_and_summary_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&operation" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description override", 8 | "operationId": "test_description_summary", 9 | "responses": { 10 | "200": { 11 | "description": "success response" 12 | } 13 | }, 14 | "summary": "This is summary override that is\nsplit to multiple lines", 15 | "tags": [] 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_extensions-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | assertion_line: 310 4 | expression: "operation.pointer(\"/x-extension-2\").unwrap()" 5 | --- 6 | { 7 | "type": "extension2", 8 | "value": 2 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_extensions.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | assertion_line: 309 4 | expression: "operation.pointer(\"/x-extension-1\").unwrap()" 5 | --- 6 | { 7 | "type": "extension1" 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_into_params_custom_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "email", 10 | "required": false, 11 | "schema": { 12 | "description": "this is the description", 13 | "format": "email", 14 | "type": "string" 15 | } 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_into_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "description": "Ok" 9 | }, 10 | "404": { 11 | "description": "Not Found" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_multiple_methods.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&paths" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/test-multiple": { 8 | "get": { 9 | "operationId": "test_multiple", 10 | "responses": { 11 | "200": { 12 | "description": "success response" 13 | } 14 | }, 15 | "tags": [] 16 | }, 17 | "head": { 18 | "operationId": "test_multiple", 19 | "responses": { 20 | "200": { 21 | "description": "success response" 22 | } 23 | }, 24 | "tags": [] 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_multiple_tags.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&operation" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "get_items", 8 | "responses": { 9 | "200": { 10 | "description": "success response" 11 | } 12 | }, 13 | "tags": [ 14 | "mytag", 15 | "one", 16 | "two", 17 | "another" 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_parameter_inline_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Foo database id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int64", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "description": "Datetime since foo is updated", 19 | "in": "query", 20 | "name": "since", 21 | "required": false, 22 | "schema": { 23 | "properties": { 24 | "date": { 25 | "description": "Some date", 26 | "type": "string" 27 | }, 28 | "time": { 29 | "description": "Some time", 30 | "type": "string" 31 | } 32 | }, 33 | "required": [ 34 | "date", 35 | "time" 36 | ], 37 | "type": "object" 38 | } 39 | } 40 | ] 41 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_parameter_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Foo database id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int64", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "description": "Datetime since foo is updated", 19 | "in": "query", 20 | "name": "since", 21 | "required": false, 22 | "schema": { 23 | "$ref": "#/components/schemas/Since" 24 | } 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_response_links.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&paths" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/test-links": { 8 | "get": { 9 | "operationId": "test_links", 10 | "responses": { 11 | "200": { 12 | "description": "success response", 13 | "links": { 14 | "getBar": { 15 | "operation_ref": "this is ref" 16 | }, 17 | "getFoo": { 18 | "operation_id": "test_links", 19 | "parameters": { 20 | "json_value": 1, 21 | "key": "value" 22 | }, 23 | "request_body": "this is body", 24 | "server": { 25 | "url": "http://localhost" 26 | } 27 | } 28 | } 29 | } 30 | }, 31 | "tags": [] 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_tag_constant.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&operation" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "get_items", 8 | "responses": { 9 | "200": { 10 | "description": "success response" 11 | } 12 | }, 13 | "tags": [ 14 | "mytag" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__derive_path_with_validation_attributes.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "id", 10 | "required": true, 11 | "schema": { 12 | "format": "int32", 13 | "maximum": 10, 14 | "minimum": 5, 15 | "multipleOf": 2.5, 16 | "type": "integer" 17 | } 18 | }, 19 | { 20 | "in": "path", 21 | "name": "value", 22 | "required": true, 23 | "schema": { 24 | "maxLength": 10, 25 | "minLength": 5, 26 | "pattern": "[a-z]*", 27 | "type": "string" 28 | } 29 | }, 30 | { 31 | "in": "path", 32 | "name": "items", 33 | "required": true, 34 | "schema": { 35 | "items": { 36 | "type": "string" 37 | }, 38 | "maxItems": 5, 39 | "minItems": 1, 40 | "type": "array" 41 | } 42 | } 43 | ] 44 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__path_and_nest_with_additional_tags.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&paths" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/api/nest/test": { 8 | "get": { 9 | "operationId": "test_path_nested", 10 | "responses": {}, 11 | "tags": [ 12 | "this_is_tag:nest", 13 | "additional:nest" 14 | ] 15 | } 16 | }, 17 | "/test": { 18 | "get": { 19 | "operationId": "test_path", 20 | "responses": {}, 21 | "tags": [ 22 | "this_is_tag", 23 | "additional" 24 | ] 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__path_and_nest_with_default_tags_from_path.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&paths" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/api/nest/test": { 8 | "get": { 9 | "operationId": "test_path_nested", 10 | "responses": {}, 11 | "tags": [ 12 | "test_nest" 13 | ] 14 | } 15 | }, 16 | "/test": { 17 | "get": { 18 | "operationId": "test_path", 19 | "responses": {}, 20 | "tags": [ 21 | "test_path" 22 | ] 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__path_derive_with_body_ref_using_as_attribute_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: operation 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "handler", 8 | "responses": { 9 | "200": { 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "$ref": "#/components/schemas/types.calculation.calculation_assembly_cost.v1.CalculationAssemblyCostResponse" 14 | } 15 | } 16 | }, 17 | "description": "Get calculated cost of an assembly." 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__path_nest_without_any_tags.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: "&paths" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/api/nest/test": { 8 | "get": { 9 | "operationId": "test_path_nested", 10 | "responses": {}, 11 | "tags": [] 12 | } 13 | }, 14 | "/test": { 15 | "get": { 16 | "operationId": "test_path", 17 | "responses": {}, 18 | "tags": [] 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive__path_parameters_with_free_form_properties.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "map", 10 | "required": true, 11 | "schema": { 12 | "additionalProperties": true, 13 | "type": "object" 14 | } 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_derive_custom_generic_wrapper-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Item" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_derive_custom_generic_wrapper.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&schemas" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "Item": { 8 | "type": "string" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Item" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/parameters\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "age", 10 | "required": true, 11 | "schema": { 12 | "format": "int32", 13 | "type": "integer" 14 | } 15 | }, 16 | { 17 | "in": "query", 18 | "name": "status", 19 | "required": true, 20 | "schema": { 21 | "type": "string" 22 | } 23 | }, 24 | { 25 | "in": "path", 26 | "name": "id", 27 | "required": true, 28 | "schema": { 29 | "format": "int32", 30 | "type": "integer" 31 | } 32 | }, 33 | { 34 | "in": "path", 35 | "name": "name", 36 | "required": true, 37 | "schema": { 38 | "type": "string" 39 | } 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args_using_custom_uuid-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Item" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args_using_custom_uuid.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/parameters\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "custom_uuid", 10 | "required": true, 11 | "schema": { 12 | "format": "uuid", 13 | "type": "string" 14 | } 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args_using_uuid-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Item" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_actix__path_with_all_args_using_uuid.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_actix.rs 3 | expression: "&operation.pointer(\"/parameters\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "uuid", 10 | "required": true, 11 | "schema": { 12 | "format": "uuid", 13 | "type": "string" 14 | } 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses__path_operation_auto_types_default_response_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses.rs 3 | expression: "&path.pointer(\"/responses\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | {} 7 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses__path_operation_auto_types_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses.rs 3 | expression: "&path.pointer(\"/responses\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Item" 12 | } 13 | } 14 | }, 15 | "description": "Item found" 16 | }, 17 | "404": { 18 | "description": "No item found" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_auto_types_fn_parameters-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/ItemBody" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_auto_types_fn_parameters.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/responses\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Item" 12 | } 13 | } 14 | }, 15 | "description": "Item found" 16 | }, 17 | "404": { 18 | "description": "No item found" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_auto_types_tuple.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "items": false, 11 | "prefixItems": [ 12 | { 13 | "properties": { 14 | "value": { 15 | "type": "string" 16 | } 17 | }, 18 | "required": [ 19 | "value" 20 | ], 21 | "type": "object" 22 | }, 23 | { 24 | "type": "string" 25 | } 26 | ], 27 | "type": "array" 28 | } 29 | } 30 | }, 31 | "required": true 32 | } 33 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_optional_json_body-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/ItemBody" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_optional_json_body.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/responses\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Item" 12 | } 13 | } 14 | }, 15 | "description": "Item found" 16 | }, 17 | "404": { 18 | "description": "No item found" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_actix__path_operation_request_body_form.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_actix.rs 3 | expression: "&path.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/x-www-form-urlencoded": { 9 | "schema": { 10 | "$ref": "#/components/schemas/ItemBody" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_auto_into_responses_axum__path_operation_auto_types_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_auto_into_responses_axum.rs 3 | expression: "&path.pointer(\"/responses\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Item" 12 | } 13 | } 14 | }, 15 | "description": "Item found" 16 | }, 17 | "404": { 18 | "description": "No item found" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__derive_path_params_into_params_axum.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Id of person", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int64", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "description": "Name of person", 19 | "in": "path", 20 | "name": "name", 21 | "required": true, 22 | "schema": { 23 | "type": "string" 24 | } 25 | }, 26 | { 27 | "deprecated": true, 28 | "description": "Age filter for user", 29 | "in": "query", 30 | "name": "age", 31 | "required": false, 32 | "schema": { 33 | "items": { 34 | "type": "string" 35 | }, 36 | "type": [ 37 | "array", 38 | "null" 39 | ] 40 | } 41 | } 42 | ] 43 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__derive_path_params_into_params_unnamed.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "id", 10 | "required": true, 11 | "schema": { 12 | "format": "int64", 13 | "minimum": 0, 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "in": "path", 19 | "name": "name", 20 | "required": true, 21 | "schema": { 22 | "type": "string" 23 | } 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__derive_path_params_with_ignored_parameter.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "id", 10 | "required": true, 11 | "schema": { 12 | "format": "int64", 13 | "minimum": 0, 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "in": "path", 19 | "name": "name", 20 | "required": true, 21 | "schema": { 22 | "type": "string" 23 | } 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__derive_path_params_with_unnamed_struct_destructed.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "id", 10 | "required": true, 11 | "schema": { 12 | "format": "int64", 13 | "minimum": 0, 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "in": "path", 19 | "name": "name", 20 | "required": true, 21 | "schema": { 22 | "type": "string" 23 | } 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__derive_path_query_params_with_named_struct_destructed.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "name", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__get_todo_with_path_tuple.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Person id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "type": "string" 14 | } 15 | }, 16 | { 17 | "description": "Person name", 18 | "in": "path", 19 | "name": "name", 20 | "required": true, 21 | "schema": { 22 | "type": "string" 23 | } 24 | } 25 | ] 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__into_params_for_option_query_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "operation.pointer(\"/parameters\")" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "", 9 | "in": "query", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int32", 14 | "minimum": 0, 15 | "type": "integer" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_derive_inline_with_tuple.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "inline_tuple", 8 | "parameters": [ 9 | { 10 | "in": "path", 11 | "name": "resource_type", 12 | "required": true, 13 | "schema": { 14 | "enum": [ 15 | "Type1", 16 | "Type2" 17 | ], 18 | "type": "string" 19 | } 20 | }, 21 | { 22 | "in": "path", 23 | "name": "id", 24 | "required": true, 25 | "schema": { 26 | "type": "string" 27 | } 28 | } 29 | ], 30 | "responses": {} 31 | } 32 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_param_single_arg_non_primitive_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "operation.pointer(\"/parameters\")" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "type": "string" 14 | } 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_param_single_arg_non_primitive_type_into_params.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "operation.pointer(\"/parameters\")" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "path", 9 | "name": "id", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | } 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_param_single_arg_primitive_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "operation.pointer(\"/parameters\")" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int32", 14 | "minimum": 0, 15 | "type": "integer" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_with_path_query_body_resolved-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Item" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_axum_test__path_with_path_query_body_resolved.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_axum_test.rs 3 | expression: "&operation.pointer(\"/parameters\").unwrap()" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "age", 10 | "required": true, 11 | "schema": { 12 | "format": "int32", 13 | "type": "integer" 14 | } 15 | }, 16 | { 17 | "in": "query", 18 | "name": "status", 19 | "required": true, 20 | "schema": { 21 | "type": "string" 22 | } 23 | }, 24 | { 25 | "in": "path", 26 | "name": "id", 27 | "required": true, 28 | "schema": { 29 | "format": "int32", 30 | "type": "integer" 31 | } 32 | }, 33 | { 34 | "in": "path", 35 | "name": "name", 36 | "required": true, 37 | "schema": { 38 | "type": "string" 39 | } 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_rocket__path_with_all_args_and_body-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_rocket.rs 3 | expression: "&operation.pointer(\"/requestBody\")" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Hello" 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_rocket__path_with_enum_path_param.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_rocket.rs 3 | expression: "operation.pointer(\"/parameters\")" 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "", 9 | "in": "path", 10 | "name": "api_version", 11 | "required": true, 12 | "schema": { 13 | "enum": [ 14 | "V1" 15 | ], 16 | "type": "string" 17 | } 18 | } 19 | ] 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_rocket__resolve_get_with_optional_query_args.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_rocket.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "colors", 10 | "required": false, 11 | "schema": { 12 | "items": { 13 | "type": "string" 14 | }, 15 | "type": "array" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_derive_rocket__resolve_path_query_params_from_form.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_derive_rocket.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "description": "Hello id", 9 | "in": "path", 10 | "name": "id", 11 | "required": true, 12 | "schema": { 13 | "format": "int32", 14 | "type": "integer" 15 | } 16 | }, 17 | { 18 | "in": "query", 19 | "name": "foo", 20 | "required": true, 21 | "schema": { 22 | "type": "string" 23 | } 24 | }, 25 | { 26 | "in": "query", 27 | "name": "bar", 28 | "required": true, 29 | "schema": { 30 | "format": "int64", 31 | "type": "integer" 32 | } 33 | } 34 | ] 35 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_parameter_derive_test__derive_path_params_with_parameter_type_args.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_parameter_derive_test.rs 3 | expression: parameters 4 | snapshot_kind: text 5 | --- 6 | [ 7 | { 8 | "allowReserved": true, 9 | "deprecated": true, 10 | "description": "Foo value description", 11 | "explode": true, 12 | "in": "query", 13 | "name": "value", 14 | "required": false, 15 | "schema": { 16 | "items": { 17 | "maxLength": 20, 18 | "pattern": "\\w", 19 | "type": "string" 20 | }, 21 | "maxItems": 1, 22 | "type": "array" 23 | }, 24 | "style": "form" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_parameter_derive_test__path_parameter_with_extensions.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_parameter_derive_test.rs 3 | assertion_line: 386 4 | expression: value 5 | --- 6 | [ 7 | { 8 | "in": "query", 9 | "name": "a_param", 10 | "required": true, 11 | "schema": { 12 | "type": "string" 13 | }, 14 | "x-param-extension": { 15 | "type": "param" 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_http_status_code_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "description": "success" 9 | }, 10 | "404": { 11 | "description": "not found" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_path_with_multiple_examples_auto_collect_schemas-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "examples": { 11 | "Demo": { 12 | "description": "Long description", 13 | "summary": "This is summary", 14 | "value": { 15 | "name": "Demo" 16 | } 17 | }, 18 | "John": { 19 | "summary": "Another user", 20 | "value": { 21 | "name": "John" 22 | } 23 | } 24 | }, 25 | "schema": { 26 | "$ref": "#/components/schemas/User" 27 | } 28 | } 29 | }, 30 | "description": "" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_path_with_multiple_examples_auto_collect_schemas.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: schemas 4 | snapshot_kind: text 5 | --- 6 | { 7 | "User": { 8 | "properties": { 9 | "name": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "name" 15 | ], 16 | "type": "object" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_path_with_multiple_responses_via_content_attribute_auto_collect_responses-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/vnd.user.v1+json": { 10 | "example": { 11 | "id": "id" 12 | }, 13 | "schema": { 14 | "$ref": "#/components/schemas/User" 15 | } 16 | }, 17 | "application/vnd.user.v2+json": { 18 | "example": { 19 | "id": 2 20 | }, 21 | "schema": { 22 | "$ref": "#/components/schemas/User2" 23 | } 24 | } 25 | }, 26 | "description": "" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_path_with_multiple_responses_via_content_attribute_auto_collect_responses.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: schemas 4 | snapshot_kind: text 5 | --- 6 | { 7 | "User": { 8 | "properties": { 9 | "id": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "id" 15 | ], 16 | "type": "object" 17 | }, 18 | "User2": { 19 | "properties": { 20 | "id": { 21 | "format": "int32", 22 | "type": "integer" 23 | } 24 | }, 25 | "required": [ 26 | "id" 27 | ], 28 | "type": "object" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__derive_response_body_inline_schema_component.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "get_foo", 8 | "responses": { 9 | "200": { 10 | "content": { 11 | "application/json": { 12 | "schema": { 13 | "properties": { 14 | "name": { 15 | "type": "string" 16 | } 17 | }, 18 | "required": [ 19 | "name" 20 | ], 21 | "type": "object" 22 | } 23 | } 24 | }, 25 | "description": "success" 26 | } 27 | }, 28 | "tags": [ 29 | "response_body_inline_schema" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__path_response_default_no_value_nor_ref.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "post_secret", 8 | "responses": { 9 | "200": { 10 | "description": "" 11 | } 12 | }, 13 | "summary": "Post some secret inner handler" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__path_response_with_extensions.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | assertion_line: 500 4 | expression: value 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "text/plain": { 10 | "schema": { 11 | "type": "string" 12 | }, 13 | "x-content-extension2": { 14 | "type": "content" 15 | } 16 | } 17 | }, 18 | "description": "Operation success", 19 | "x-response-extension1": { 20 | "type": "response" 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__path_response_with_external_ref.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "./MyUser.json" 12 | } 13 | } 14 | }, 15 | "description": "" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__path_response_with_inline_ref_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "properties": { 12 | "name": { 13 | "type": "string" 14 | } 15 | }, 16 | "required": [ 17 | "name" 18 | ], 19 | "type": "object" 20 | } 21 | } 22 | }, 23 | "description": "" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/path_response_derive_test__path_response_with_no_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/path_response_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "operationId": "post_secret", 8 | "responses": { 9 | "200": { 10 | "content": { 11 | "application/octet-stream": {} 12 | }, 13 | "description": "" 14 | } 15 | }, 16 | "summary": "Post some secret inner handler" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_multi_content_type_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Foo" 11 | } 12 | }, 13 | "text/xml": { 14 | "schema": { 15 | "$ref": "#/components/schemas/Foo" 16 | } 17 | } 18 | }, 19 | "description": "Create new Foo", 20 | "required": true 21 | } 22 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_primitive_array_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": { 8 | "schema": { 9 | "items": { 10 | "format": "int32", 11 | "type": "integer" 12 | }, 13 | "type": "array" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_required_explicit_false_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "text/xml": { 9 | "schema": { 10 | "oneOf": [ 11 | { 12 | "type": "null" 13 | }, 14 | { 15 | "$ref": "#/components/schemas/Foo" 16 | } 17 | ] 18 | } 19 | } 20 | }, 21 | "description": "Create new Foo" 22 | } 23 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "text/xml": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Foo" 11 | } 12 | } 13 | }, 14 | "description": "Create new Foo", 15 | "required": true 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_success_array.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "text/xml": { 9 | "schema": { 10 | "items": { 11 | "$ref": "#/components/schemas/Foo" 12 | }, 13 | "type": "array" 14 | } 15 | } 16 | }, 17 | "description": "Create new Foo", 18 | "required": true 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_success_inline.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "text/xml": { 9 | "schema": { 10 | "description": "Some struct", 11 | "properties": { 12 | "name": { 13 | "description": "Some name", 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "name" 19 | ], 20 | "type": "object" 21 | } 22 | } 23 | }, 24 | "description": "Create new Foo", 25 | "required": true 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_complex_success_inline_array.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "text/xml": { 9 | "schema": { 10 | "items": { 11 | "description": "Some struct", 12 | "properties": { 13 | "name": { 14 | "description": "Some name", 15 | "type": "string" 16 | } 17 | }, 18 | "required": [ 19 | "name" 20 | ], 21 | "type": "object" 22 | }, 23 | "type": "array" 24 | } 25 | } 26 | }, 27 | "description": "Create new Foo", 28 | "required": true 29 | } 30 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_option_array_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "items": { 11 | "$ref": "#/components/schemas/Foo" 12 | }, 13 | "type": [ 14 | "array", 15 | "null" 16 | ] 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_primitive_array_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": { 8 | "schema": { 9 | "items": { 10 | "format": "int64", 11 | "type": "integer" 12 | }, 13 | "type": "array" 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_simple_inline_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "description": "Some struct", 11 | "properties": { 12 | "name": { 13 | "description": "Some name", 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "name" 19 | ], 20 | "type": "object" 21 | } 22 | } 23 | }, 24 | "required": true 25 | } 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__derive_request_body_with_multiple_content_type_guess_default_content_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/Foo" 11 | } 12 | }, 13 | "text/xml": { 14 | "schema": { 15 | "$ref": "#/components/schemas/Foo" 16 | } 17 | } 18 | }, 19 | "description": "Create new Foo", 20 | "required": true 21 | } 22 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__multiple_content_with_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "examples": { 10 | "example1": { 11 | "description": "Foo name example", 12 | "value": "Foo name" 13 | }, 14 | "example2": { 15 | "description": "example value", 16 | "value": "example value" 17 | } 18 | }, 19 | "schema": { 20 | "$ref": "#/components/schemas/Foo" 21 | } 22 | }, 23 | "text/xml": { 24 | "example": "Value", 25 | "schema": { 26 | "$ref": "#/components/schemas/Foo" 27 | } 28 | } 29 | }, 30 | "description": "Create new Foo", 31 | "required": true 32 | } 33 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__multiple_request_body_with_only_content_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": {}, 9 | "text/xml": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Foo" 12 | } 13 | } 14 | }, 15 | "description": "Create new Foo", 16 | "required": true 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_binary.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/octet-stream": { 8 | "schema": { 9 | "items": { 10 | "format": "int32", 11 | "minimum": 0, 12 | "type": "integer" 13 | }, 14 | "type": "array" 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_example.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": { 8 | "example": { 9 | "value": "this is value" 10 | }, 11 | "schema": { 12 | "$ref": "#/components/schemas/Foo" 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": { 8 | "examples": { 9 | "Value1": { 10 | "value": { 11 | "value": "this is value" 12 | } 13 | }, 14 | "Value2": { 15 | "value": { 16 | "value": "this is value2" 17 | } 18 | } 19 | }, 20 | "schema": { 21 | "$ref": "#/components/schemas/Foo" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_extensions.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | assertion_line: 600 4 | expression: request_body 5 | --- 6 | { 7 | "content": { 8 | "text/plain": { 9 | "x-request-body-ext2": { 10 | "type": "request_body/text/plain" 11 | } 12 | } 13 | }, 14 | "x-request-body-ext1": { 15 | "type": "request_body" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_external_ref.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": { 8 | "schema": { 9 | "$ref": "./MyUser.json" 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__request_body_with_only_single_content_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: content 4 | snapshot_kind: text 5 | --- 6 | { 7 | "application/json": {} 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/request_body_derive_test__unit_type_request_body.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/request_body_derive_test.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "default": null 11 | } 12 | } 13 | }, 14 | "required": true 15 | } 16 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_enum_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "oneOf": [ 12 | { 13 | "type": "object", 14 | "required": [ 15 | "Value" 16 | ], 17 | "properties": { 18 | "Value": { 19 | "type": "string" 20 | } 21 | } 22 | }, 23 | { 24 | "type": "string", 25 | "enum": [ 26 | "Foobar" 27 | ] 28 | } 29 | ] 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_inline_named_struct_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "200": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "description": "This is success response", 12 | "properties": { 13 | "value": { 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "value" 19 | ], 20 | "type": "object" 21 | } 22 | } 23 | }, 24 | "description": "This is success response" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unit_struct.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "404": { 8 | "description": "Not found response" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unnamed_struct_inline_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "201": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "properties": { 12 | "bar": { 13 | "type": "string" 14 | } 15 | }, 16 | "required": [ 17 | "bar" 18 | ], 19 | "type": "object" 20 | } 21 | } 22 | }, 23 | "description": "" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unnamed_struct_ref_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "201": { 8 | "$ref": "#/components/responses/Foo" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unnamed_struct_ref_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "201": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Foo" 12 | } 13 | } 14 | }, 15 | "description": "" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unnamed_struct_to_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "201": { 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "properties": { 12 | "bar": { 13 | "type": "string" 14 | } 15 | }, 16 | "required": [ 17 | "bar" 18 | ], 19 | "type": "object" 20 | } 21 | } 22 | }, 23 | "description": "" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_into_responses_unnamed_struct_with_primitive_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: responses 4 | snapshot_kind: text 5 | --- 6 | { 7 | "201": { 8 | "content": { 9 | "text/plain": { 10 | "schema": { 11 | "type": "string" 12 | } 13 | } 14 | }, 15 | "description": "" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_name_struct_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "type": "object", 12 | "required": [ 13 | "name" 14 | ], 15 | "properties": { 16 | "name": { 17 | "type": "string" 18 | } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_response_multiple_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "type": "object", 12 | "required": [ 13 | "name" 14 | ], 15 | "properties": { 16 | "name": { 17 | "type": "string" 18 | } 19 | } 20 | }, 21 | "examples": { 22 | "Person1": { 23 | "value": { 24 | "name": "name1" 25 | } 26 | }, 27 | "Person2": { 28 | "value": { 29 | "name": "name2" 30 | } 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_response_with_attributes.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "Override description for response", 8 | "headers": { 9 | "csrf-token": { 10 | "schema": { 11 | "type": "string" 12 | }, 13 | "description": "response csrf token" 14 | }, 15 | "random-id": { 16 | "schema": { 17 | "type": "integer", 18 | "format": "int32" 19 | } 20 | } 21 | }, 22 | "content": { 23 | "text/xml": { 24 | "schema": { 25 | "type": "object", 26 | "description": "This is description\n\nIt will also be used in `ToSchema` if present", 27 | "required": [ 28 | "name" 29 | ], 30 | "properties": { 31 | "name": { 32 | "type": "string" 33 | } 34 | } 35 | }, 36 | "example": { 37 | "name": "the name" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_response_with_enum_contents.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json/1": { 10 | "schema": { 11 | "$ref": "#/components/schemas/Admin" 12 | }, 13 | "examples": { 14 | "Person1": { 15 | "value": { 16 | "name": "name1" 17 | } 18 | }, 19 | "Person2": { 20 | "value": { 21 | "name": "name2" 22 | } 23 | } 24 | } 25 | }, 26 | "application/json/2": { 27 | "schema": { 28 | "$ref": "#/components/schemas/Moderator" 29 | }, 30 | "example": { 31 | "name": "name3" 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_response_with_inline_unnamed_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "type": "array", 12 | "items": { 13 | "type": "object", 14 | "required": [ 15 | "name" 16 | ], 17 | "properties": { 18 | "name": { 19 | "type": "string" 20 | } 21 | } 22 | } 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_response_with_unit_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "" 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_struct_response_with_description.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description\n\nIt will also be used in `ToSchema` if present", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "type": "object", 12 | "description": "This is description\n\nIt will also be used in `ToSchema` if present", 13 | "required": [ 14 | "name" 15 | ], 16 | "properties": { 17 | "name": { 18 | "type": "string" 19 | } 20 | } 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/response_derive_test__derive_unnamed_struct_response.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/response_derive_test.rs 3 | expression: v 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "type": "array", 12 | "items": { 13 | "type": "string" 14 | } 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__const_generic_test.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "array_response": { 9 | "$ref": "#/components/schemas/ArrayResponse_String" 10 | } 11 | }, 12 | "required": [ 13 | "array_response" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__content_encoding_named_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: item 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "picture": { 9 | "contentEncoding": "bas64", 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "picture" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__content_media_type_named_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: item 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "doc": { 9 | "contentMediaType": "application/octet-stream", 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "doc" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_btreeset.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "values": { 9 | "items": { 10 | "type": "string" 11 | }, 12 | "type": "array", 13 | "uniqueItems": true 14 | } 15 | }, 16 | "required": [ 17 | "values" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_complex_unnamed_field_reference_with_comment.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "description": "Since OpenAPI 3.1 the comments can be added to the Ref types as well", 10 | "properties": { 11 | "UnnamedFieldWithCommentReference": { 12 | "$ref": "#/components/schemas/CommentedReference", 13 | "description": "Since OpenAPI 3.1 the comments can be added to the Ref types as well" 14 | } 15 | }, 16 | "required": [ 17 | "UnnamedFieldWithCommentReference" 18 | ], 19 | "type": "object" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_generic_types_having_path_expression.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: args 4 | snapshot_kind: text 5 | --- 6 | { 7 | "items": { 8 | "items": { 9 | "type": "string" 10 | }, 11 | "type": "array" 12 | }, 13 | "type": "array" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_jiff_0_2_feature.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: "&doc" 4 | --- 5 | { 6 | "properties": { 7 | "civil_date": { 8 | "format": "date", 9 | "type": "string" 10 | }, 11 | "zoned": { 12 | "format": "date-time", 13 | "type": "string" 14 | } 15 | }, 16 | "required": [ 17 | "civil_date", 18 | "zoned" 19 | ], 20 | "type": "object" 21 | } 22 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_linked_list.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: example_schema 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "values": { 9 | "items": { 10 | "format": "double", 11 | "type": "number" 12 | }, 13 | "type": "array" 14 | } 15 | }, 16 | "required": [ 17 | "values" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_mixed_enum_lifetimes.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "A": { 11 | "properties": { 12 | "foo": { 13 | "$ref": "#/components/schemas/Foo" 14 | } 15 | }, 16 | "required": [ 17 | "foo" 18 | ], 19 | "type": "object" 20 | } 21 | }, 22 | "required": [ 23 | "A" 24 | ], 25 | "type": "object" 26 | }, 27 | { 28 | "enum": [ 29 | "B" 30 | ], 31 | "type": "string" 32 | }, 33 | { 34 | "enum": [ 35 | "C" 36 | ], 37 | "type": "string" 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_raw_identifier.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "in": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "in" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_smallvec_feature.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: bar 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "links": { 9 | "items": { 10 | "type": "string" 11 | }, 12 | "type": "array" 13 | } 14 | }, 15 | "required": [ 16 | "links" 17 | ], 18 | "type": "object" 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_component_with_time_feature.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: "×" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "date": { 9 | "format": "date", 10 | "type": "string" 11 | }, 12 | "datetime": { 13 | "format": "date-time", 14 | "type": "string" 15 | }, 16 | "duration": { 17 | "type": "string" 18 | }, 19 | "primitive_date_time": { 20 | "format": "date-time", 21 | "type": "string" 22 | } 23 | }, 24 | "required": [ 25 | "datetime", 26 | "primitive_date_time", 27 | "date", 28 | "duration" 29 | ], 30 | "type": "object" 31 | } 32 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_enum_with_inline_variant.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: card 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "Number": { 11 | "enum": [ 12 | "One", 13 | "Two", 14 | "Three", 15 | "Four", 16 | "Five", 17 | "Six", 18 | "Seven", 19 | "Height", 20 | "Nine" 21 | ], 22 | "type": "string" 23 | } 24 | }, 25 | "required": [ 26 | "Number" 27 | ], 28 | "type": "object" 29 | }, 30 | { 31 | "properties": { 32 | "Color": { 33 | "enum": [ 34 | "Spade", 35 | "Heart", 36 | "Club", 37 | "Diamond" 38 | ], 39 | "type": "string" 40 | } 41 | }, 42 | "required": [ 43 | "Color" 44 | ], 45 | "type": "object" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_enum_with_self_reference.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "Item": { 11 | "$ref": "#/components/schemas/EnumValue" 12 | } 13 | }, 14 | "required": [ 15 | "Item" 16 | ], 17 | "type": "object" 18 | }, 19 | { 20 | "properties": { 21 | "Item2": { 22 | "properties": { 23 | "value": { 24 | "$ref": "#/components/schemas/EnumValue" 25 | } 26 | }, 27 | "required": [ 28 | "value" 29 | ], 30 | "type": "object" 31 | } 32 | }, 33 | "required": [ 34 | "Item2" 35 | ], 36 | "type": "object" 37 | } 38 | ] 39 | } 40 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_enum_with_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "enum": [ 8 | "Admin", 9 | "Moderator", 10 | "User" 11 | ], 12 | "title": "UserType", 13 | "type": "string" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_enum_with_unnamed_primitive_field_with_tag.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "tag": { 11 | "enum": [ 12 | "Value" 13 | ], 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "tag" 19 | ], 20 | "type": "object" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_enum_with_unnamed_single_field_with_tag.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "allOf": [ 10 | { 11 | "$ref": "#/components/schemas/ReferenceValue" 12 | }, 13 | { 14 | "properties": { 15 | "enum": { 16 | "enum": [ 17 | "Value" 18 | ], 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "enum" 24 | ], 25 | "type": "object" 26 | } 27 | ] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_flattened_map_ref_property.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: map 4 | snapshot_kind: text 5 | --- 6 | { 7 | "additionalProperties": { 8 | "$ref": "#/components/schemas/Foo" 9 | }, 10 | "type": "object" 11 | } 12 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_flattened_map_string_property.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: map 4 | snapshot_kind: text 5 | --- 6 | { 7 | "additionalProperties": { 8 | "type": "string" 9 | }, 10 | "type": "object" 11 | } 12 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_hashset.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "values": { 9 | "items": { 10 | "type": "string" 11 | }, 12 | "type": "array", 13 | "uniqueItems": true 14 | } 15 | }, 16 | "required": [ 17 | "values" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_map_free_form_property.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: map 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "map": { 9 | "additionalProperties": true, 10 | "type": "object" 11 | } 12 | }, 13 | "required": [ 14 | "map" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_map_ref.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: map 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "map": { 9 | "additionalProperties": { 10 | "$ref": "#/components/schemas/Foo" 11 | }, 12 | "propertyNames": { 13 | "type": "string" 14 | }, 15 | "type": "object" 16 | }, 17 | "map2": { 18 | "additionalProperties": { 19 | "enum": [ 20 | "Variant" 21 | ], 22 | "type": "string" 23 | }, 24 | "propertyNames": { 25 | "type": "string" 26 | }, 27 | "type": "object" 28 | } 29 | }, 30 | "required": [ 31 | "map", 32 | "map2" 33 | ], 34 | "type": "object" 35 | } 36 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_map_with_property_names.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "additionalProperties": { 8 | "type": "string" 9 | }, 10 | "propertyNames": { 11 | "enum": [ 12 | "Foo", 13 | "Bar" 14 | ], 15 | "type": "string" 16 | }, 17 | "type": "object" 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_as.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: "&value" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "Foo": { 11 | "properties": { 12 | "foo": { 13 | "$ref": "#/components/schemas/Foobar" 14 | } 15 | }, 16 | "required": [ 17 | "foo" 18 | ], 19 | "type": "object" 20 | } 21 | }, 22 | "required": [ 23 | "Foo" 24 | ], 25 | "type": "object" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_description_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description from include_str!\n", 8 | "oneOf": [ 9 | { 10 | "enum": [ 11 | "Value1" 12 | ], 13 | "type": "string" 14 | }, 15 | { 16 | "properties": { 17 | "User": { 18 | "$ref": "#/components/schemas/User" 19 | } 20 | }, 21 | "required": [ 22 | "User" 23 | ], 24 | "type": "object" 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_serde_adjacently_tagged.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "content": { 11 | "format": "int32", 12 | "type": "integer" 13 | }, 14 | "tag": { 15 | "enum": [ 16 | "Bar" 17 | ], 18 | "type": "string" 19 | } 20 | }, 21 | "required": [ 22 | "content", 23 | "tag" 24 | ], 25 | "type": "object" 26 | }, 27 | { 28 | "properties": { 29 | "content": { 30 | "type": "string" 31 | }, 32 | "tag": { 33 | "enum": [ 34 | "Baz" 35 | ], 36 | "type": "string" 37 | } 38 | }, 39 | "required": [ 40 | "content", 41 | "tag" 42 | ], 43 | "type": "object" 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_serde_tag.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "tag": { 11 | "enum": [ 12 | "UnitValue" 13 | ], 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "tag" 19 | ], 20 | "type": "object" 21 | }, 22 | { 23 | "properties": { 24 | "id": { 25 | "type": "string" 26 | }, 27 | "names": { 28 | "items": { 29 | "type": "string" 30 | }, 31 | "type": [ 32 | "array", 33 | "null" 34 | ] 35 | }, 36 | "tag": { 37 | "enum": [ 38 | "NamedFields" 39 | ], 40 | "type": "string" 41 | } 42 | }, 43 | "required": [ 44 | "id", 45 | "tag" 46 | ], 47 | "type": "object" 48 | } 49 | ] 50 | } 51 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_serde_tag_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "tag": { 11 | "enum": [ 12 | "UnitValue" 13 | ], 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "tag" 19 | ], 20 | "title": "Unit", 21 | "type": "object" 22 | }, 23 | { 24 | "properties": { 25 | "id": { 26 | "type": "string" 27 | }, 28 | "tag": { 29 | "enum": [ 30 | "NamedFields" 31 | ], 32 | "type": "string" 33 | } 34 | }, 35 | "required": [ 36 | "id", 37 | "tag" 38 | ], 39 | "title": "Named", 40 | "type": "object" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_serde_untagged.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "format": "int32", 10 | "type": "integer" 11 | }, 12 | { 13 | "type": "string" 14 | } 15 | ], 16 | "title": "FooTitle" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "enum": [ 10 | "UnitValue" 11 | ], 12 | "title": "Unit", 13 | "type": "string" 14 | }, 15 | { 16 | "properties": { 17 | "NamedFields": { 18 | "properties": { 19 | "id": { 20 | "type": "string" 21 | } 22 | }, 23 | "required": [ 24 | "id" 25 | ], 26 | "type": "object" 27 | } 28 | }, 29 | "required": [ 30 | "NamedFields" 31 | ], 32 | "title": "Named", 33 | "type": "object" 34 | }, 35 | { 36 | "properties": { 37 | "UnnamedFields": { 38 | "$ref": "#/components/schemas/Foo" 39 | } 40 | }, 41 | "required": [ 42 | "UnnamedFields" 43 | ], 44 | "title": "Unnamed", 45 | "type": "object" 46 | } 47 | ] 48 | } 49 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_use_serde_rename_over_custom_rename.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "string_value": { 11 | "type": "string" 12 | } 13 | }, 14 | "required": [ 15 | "string_value" 16 | ], 17 | "type": "object" 18 | }, 19 | { 20 | "properties": { 21 | "number": { 22 | "properties": { 23 | "id": { 24 | "format": "int32", 25 | "type": "integer" 26 | } 27 | }, 28 | "required": [ 29 | "id" 30 | ], 31 | "type": "object" 32 | } 33 | }, 34 | "required": [ 35 | "number" 36 | ], 37 | "type": "object" 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_discriminator_simple_form.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "discriminator": { 8 | "propertyName": "bar" 9 | }, 10 | "oneOf": [ 11 | { 12 | "$ref": "#/components/schemas/BarBarInternal" 13 | }, 14 | { 15 | "$ref": "#/components/schemas/FooInternal" 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_discriminator_with_mapping.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "discriminator": { 8 | "mapping": { 9 | "bar": "#/components/schemas/BarBarInternal", 10 | "foo": "#/components/schemas/FooInternal" 11 | }, 12 | "propertyName": "bar_type" 13 | }, 14 | "oneOf": [ 15 | { 16 | "$ref": "#/components/schemas/BarBarInternal" 17 | }, 18 | { 19 | "$ref": "#/components/schemas/FooInternal" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_ref_serde_adjacently_tagged.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "content": { 11 | "format": "int32", 12 | "type": "integer" 13 | }, 14 | "tag": { 15 | "enum": [ 16 | "Baz" 17 | ], 18 | "type": "string" 19 | } 20 | }, 21 | "required": [ 22 | "content", 23 | "tag" 24 | ], 25 | "type": "object" 26 | }, 27 | { 28 | "properties": { 29 | "content": { 30 | "$ref": "#/components/schemas/Foo" 31 | }, 32 | "tag": { 33 | "enum": [ 34 | "FooBar" 35 | ], 36 | "type": "string" 37 | } 38 | }, 39 | "required": [ 40 | "content", 41 | "tag" 42 | ], 43 | "type": "object" 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_ref_serde_untagged.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "format": "int32", 10 | "type": "integer" 11 | }, 12 | { 13 | "$ref": "#/components/schemas/Foo" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_ref_serde_untagged_named_fields.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "n": { 11 | "format": "int32", 12 | "type": "integer" 13 | } 14 | }, 15 | "required": [ 16 | "n" 17 | ], 18 | "type": "object" 19 | }, 20 | { 21 | "properties": { 22 | "bar": { 23 | "$ref": "#/components/schemas/Bar" 24 | } 25 | }, 26 | "required": [ 27 | "bar" 28 | ], 29 | "type": "object" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_ref_serde_untagged_named_fields_rename_all.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "someNumber": { 11 | "format": "int32", 12 | "type": "integer" 13 | } 14 | }, 15 | "required": [ 16 | "someNumber" 17 | ], 18 | "type": "object" 19 | }, 20 | { 21 | "properties": { 22 | "someBar": { 23 | "$ref": "#/components/schemas/Bar" 24 | } 25 | }, 26 | "required": [ 27 | "someBar" 28 | ], 29 | "type": "object" 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_mixed_enum_with_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "Admin": { 11 | "type": "string" 12 | } 13 | }, 14 | "required": [ 15 | "Admin" 16 | ], 17 | "title": "admin", 18 | "type": "object" 19 | }, 20 | { 21 | "properties": { 22 | "Moderator": { 23 | "properties": { 24 | "id": { 25 | "format": "int32", 26 | "type": "integer" 27 | } 28 | }, 29 | "required": [ 30 | "id" 31 | ], 32 | "type": "object" 33 | } 34 | }, 35 | "required": [ 36 | "Moderator" 37 | ], 38 | "title": "moderator", 39 | "type": "object" 40 | }, 41 | { 42 | "enum": [ 43 | "User" 44 | ], 45 | "title": "user", 46 | "type": "string" 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_negative_numbers.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "number": { 9 | "default": -1, 10 | "format": "double", 11 | "minimum": -2.1, 12 | "type": "number" 13 | }, 14 | "solid_number": { 15 | "default": -2, 16 | "format": "int64", 17 | "maximum": -3, 18 | "type": "integer" 19 | } 20 | }, 21 | "required": [ 22 | "number", 23 | "solid_number" 24 | ], 25 | "type": "object" 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_nullable_tuple.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "info": { 9 | "deprecated": true, 10 | "description": "This is description", 11 | "items": false, 12 | "prefixItems": [ 13 | { 14 | "type": "string" 15 | }, 16 | { 17 | "format": "int64", 18 | "type": "integer" 19 | } 20 | ], 21 | "type": [ 22 | "array", 23 | "null" 24 | ] 25 | } 26 | }, 27 | "type": "object" 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_parse_serde_field_attributes.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: post 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "longFieldNum": { 9 | "format": "int64", 10 | "type": "integer" 11 | }, 12 | "uuid": { 13 | "type": "string" 14 | } 15 | }, 16 | "required": [ 17 | "uuid", 18 | "longFieldNum" 19 | ], 20 | "type": "object" 21 | } 22 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_multiple_serde_definitions.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "ID": { 9 | "type": "string" 10 | } 11 | }, 12 | "type": "object" 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_unnamed_title-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: enum_value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "$ref": "#/components/schemas/UnnamedEnum" 10 | } 11 | ], 12 | "title": "This is enum ref title" 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_unnamed_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "items": { 8 | "type": "string" 9 | }, 10 | "title": "This is vec title", 11 | "type": "array" 12 | } 13 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_custom_field_with_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "description": "this is the description", 10 | "format": "email", 11 | "type": "string" 12 | } 13 | }, 14 | "required": [ 15 | "id" 16 | ], 17 | "type": "object" 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_default_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "field": { 9 | "type": "string" 10 | } 11 | }, 12 | "type": "object" 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_default_struct.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "field": { 9 | "default": "", 10 | "type": "string" 11 | } 12 | }, 13 | "type": "object" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_docstring_on_unit_variant_of_enum.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "top level doc for My enum", 8 | "oneOf": [ 9 | { 10 | "description": "unit variant doc", 11 | "enum": [ 12 | "UnitVariant" 13 | ], 14 | "type": "string" 15 | }, 16 | { 17 | "description": "non-unit doc", 18 | "properties": { 19 | "NonUnitVariant": { 20 | "description": "non-unit doc", 21 | "type": "string" 22 | } 23 | }, 24 | "required": [ 25 | "NonUnitVariant" 26 | ], 27 | "type": "object" 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_explicit_value_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "any": {} 9 | }, 10 | "required": [ 11 | "any" 12 | ], 13 | "type": "object" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_ignore_eq_call_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "this_is_not_private": { 9 | "type": "string" 10 | }, 11 | "value": { 12 | "type": "string" 13 | } 14 | }, 15 | "required": [ 16 | "value", 17 | "this_is_not_private" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_ignore_eq_false_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "this_is_not_private": { 9 | "type": "string" 10 | }, 11 | "value": { 12 | "type": "string" 13 | } 14 | }, 15 | "required": [ 16 | "value", 17 | "this_is_not_private" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_ignored_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "value": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "value" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_implicit_value_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "any": {} 9 | }, 10 | "required": [ 11 | "any" 12 | ], 13 | "type": "object" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_multiple_schema_attributes.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "name": { 9 | "maxLength": 10, 10 | "minLength": 5, 11 | "type": "string" 12 | } 13 | }, 14 | "required": [ 15 | "name" 16 | ], 17 | "type": "object" 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_object_type_description.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "object": { 9 | "description": "This is object value", 10 | "type": "object" 11 | } 12 | }, 13 | "required": [ 14 | "object" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_slice_and_array.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "array": { 9 | "items": { 10 | "type": "string" 11 | }, 12 | "type": "array" 13 | }, 14 | "slice": { 15 | "items": { 16 | "type": "string" 17 | }, 18 | "type": "array" 19 | } 20 | }, 21 | "required": [ 22 | "array", 23 | "slice" 24 | ], 25 | "type": "object" 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_schema_with_unit_hashmap.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "volumes": { 9 | "additionalProperties": { 10 | "additionalProperties": { 11 | "default": null 12 | }, 13 | "propertyNames": { 14 | "default": null 15 | }, 16 | "type": "object" 17 | }, 18 | "propertyNames": { 19 | "type": "string" 20 | }, 21 | "type": "object" 22 | } 23 | }, 24 | "required": [ 25 | "volumes" 26 | ], 27 | "type": "object" 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_serde_flatten-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "allOf": [ 8 | { 9 | "$ref": "#/components/schemas/Record" 10 | }, 11 | { 12 | "$ref": "#/components/schemas/Pagination" 13 | }, 14 | { 15 | "properties": { 16 | "id": { 17 | "type": "string" 18 | } 19 | }, 20 | "required": [ 21 | "id" 22 | ], 23 | "type": "object" 24 | } 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_serde_flatten.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "allOf": [ 8 | { 9 | "$ref": "#/components/schemas/Metadata" 10 | }, 11 | { 12 | "properties": { 13 | "amount": { 14 | "format": "int64", 15 | "type": "integer" 16 | }, 17 | "description": { 18 | "type": "string" 19 | } 20 | }, 21 | "required": [ 22 | "amount", 23 | "description" 24 | ], 25 | "type": "object" 26 | } 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_simple_enum.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "enum": [ 8 | "A", 9 | "B", 10 | "C" 11 | ], 12 | "type": "string" 13 | } 14 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_simple_enum_description_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description from include_str!\n", 8 | "enum": [ 9 | "Value1" 10 | ], 11 | "type": "string" 12 | } 13 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_simple_enum_serde_tag.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "properties": { 10 | "tag": { 11 | "enum": [ 12 | "A" 13 | ], 14 | "type": "string" 15 | } 16 | }, 17 | "required": [ 18 | "tag" 19 | ], 20 | "type": "object" 21 | }, 22 | { 23 | "properties": { 24 | "tag": { 25 | "enum": [ 26 | "B" 27 | ], 28 | "type": "string" 29 | } 30 | }, 31 | "required": [ 32 | "tag" 33 | ], 34 | "type": "object" 35 | }, 36 | { 37 | "properties": { 38 | "tag": { 39 | "enum": [ 40 | "C" 41 | ], 42 | "type": "string" 43 | } 44 | }, 45 | "required": [ 46 | "tag" 47 | ], 48 | "type": "object" 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_simple_enum_serde_tag_with_flatten_content.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "allOf": [ 10 | { 11 | "$ref": "#/components/schemas/Foo" 12 | }, 13 | { 14 | "properties": { 15 | "tag": { 16 | "enum": [ 17 | "One" 18 | ], 19 | "type": "string" 20 | } 21 | }, 22 | "required": [ 23 | "tag" 24 | ], 25 | "type": "object" 26 | } 27 | ] 28 | } 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_simple_enum_serde_untagged.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "default": null, 8 | "type": "null" 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_custom_rename.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "CREATED-AT": { 9 | "format": "int64", 10 | "type": "integer" 11 | }, 12 | "POST-ID": { 13 | "format": "int64", 14 | "type": "integer" 15 | }, 16 | "post_comment": { 17 | "type": "string" 18 | } 19 | }, 20 | "required": [ 21 | "POST-ID", 22 | "CREATED-AT", 23 | "post_comment" 24 | ], 25 | "type": "object" 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_field_with_example.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "field1": { 9 | "example": "test", 10 | "type": "string" 11 | }, 12 | "field2": { 13 | "example": "test", 14 | "type": "string" 15 | }, 16 | "field3": { 17 | "additionalProperties": { 18 | "type": "string" 19 | }, 20 | "example": { 21 | "key1": "value1" 22 | }, 23 | "propertyNames": { 24 | "type": "string" 25 | }, 26 | "type": "object" 27 | }, 28 | "field4": { 29 | "additionalProperties": { 30 | "$ref": "#/components/schemas/MyStruct" 31 | }, 32 | "example": { 33 | "key1": "value1" 34 | }, 35 | "propertyNames": { 36 | "type": "string" 37 | }, 38 | "type": "object" 39 | } 40 | }, 41 | "required": [ 42 | "field1", 43 | "field2", 44 | "field3", 45 | "field4" 46 | ], 47 | "type": "object" 48 | } 49 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_inline_with_description.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: "&value" 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "no_description_inline": { 9 | "properties": { 10 | "name": { 11 | "type": "string" 12 | } 13 | }, 14 | "required": [ 15 | "name" 16 | ], 17 | "type": "object" 18 | }, 19 | "with_description": { 20 | "description": "This is description", 21 | "oneOf": [ 22 | { 23 | "properties": { 24 | "name": { 25 | "type": "string" 26 | } 27 | }, 28 | "required": [ 29 | "name" 30 | ], 31 | "type": "object" 32 | } 33 | ] 34 | } 35 | }, 36 | "required": [ 37 | "with_description", 38 | "no_description_inline" 39 | ], 40 | "type": "object" 41 | } 42 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_override_type_with_a_reference.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "field": { 9 | "$ref": "#/components/schemas/NewBar" 10 | } 11 | }, 12 | "required": [ 13 | "field" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_override_type_with_object_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "field": { 9 | "type": "object" 10 | } 11 | }, 12 | "required": [ 13 | "field" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_unnamed_field_reference_with_comment.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "$ref": "#/components/schemas/Bar", 8 | "description": "Since OpenAPI 3.1 the description can be applied to Ref types" 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_arc.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "greeting": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "greeting" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_collection_of_arcs.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "greeting": { 9 | "items": { 10 | "type": "string" 11 | }, 12 | "type": "array" 13 | } 14 | }, 15 | "required": [ 16 | "greeting" 17 | ], 18 | "type": "object" 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_description_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is overridden description", 8 | "properties": { 9 | "field1": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "field1" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "examples": [ 8 | { 9 | "username": "kim" 10 | }, 11 | { 12 | "username": "jim" 13 | } 14 | ], 15 | "properties": { 16 | "username": { 17 | "examples": [ 18 | "foobar", 19 | "barfoo" 20 | ], 21 | "type": "string" 22 | } 23 | }, 24 | "required": [ 25 | "username" 26 | ], 27 | "type": "object" 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_nested_arc.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "greeting": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "greeting" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_no_additional_properties.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "additionalProperties": false, 8 | "properties": { 9 | "field": { 10 | "type": "string" 11 | } 12 | }, 13 | "required": [ 14 | "field" 15 | ], 16 | "type": "object" 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_rc.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: greeting 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "greeting": { 9 | "type": "string" 10 | } 11 | }, 12 | "required": [ 13 | "greeting" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_self_reference.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "type": "string" 10 | }, 11 | "previous": { 12 | "$ref": "#/components/schemas/Item" 13 | } 14 | }, 15 | "required": [ 16 | "id", 17 | "previous" 18 | ], 19 | "type": "object" 20 | } 21 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_title.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "format": "int64", 10 | "type": "integer" 11 | } 12 | }, 13 | "required": [ 14 | "id" 15 | ], 16 | "title": "Post", 17 | "type": "object" 18 | } 19 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_with_vec_field_with_example.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: post 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "format": "int32", 10 | "type": "integer" 11 | }, 12 | "value": { 13 | "example": [ 14 | "foobar", 15 | "barfoo" 16 | ], 17 | "items": { 18 | "type": "string" 19 | }, 20 | "type": "array" 21 | } 22 | }, 23 | "required": [ 24 | "id", 25 | "value" 26 | ], 27 | "type": "object" 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_struct_xml_with_optional_vec.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: user 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "format": "int64", 10 | "type": "integer", 11 | "xml": { 12 | "attribute": true, 13 | "prefix": "u" 14 | } 15 | }, 16 | "links": { 17 | "items": { 18 | "type": "string", 19 | "xml": { 20 | "name": "link" 21 | } 22 | }, 23 | "type": [ 24 | "array", 25 | "null" 26 | ], 27 | "xml": { 28 | "name": "linkList", 29 | "wrapped": true 30 | } 31 | } 32 | }, 33 | "required": [ 34 | "id" 35 | ], 36 | "type": "object", 37 | "xml": { 38 | "name": "user" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_tuple_named_struct_field.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "info": { 9 | "items": false, 10 | "prefixItems": [ 11 | { 12 | "type": "string" 13 | }, 14 | { 15 | "format": "int64", 16 | "type": "integer" 17 | }, 18 | { 19 | "type": "boolean" 20 | }, 21 | { 22 | "properties": { 23 | "name": { 24 | "type": "string" 25 | } 26 | }, 27 | "required": [ 28 | "name" 29 | ], 30 | "type": "object" 31 | } 32 | ], 33 | "type": "array" 34 | } 35 | }, 36 | "required": [ 37 | "info" 38 | ], 39 | "type": "object" 40 | } 41 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unit_struct_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "default": null 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unit_type.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: data 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "unit_type": { 9 | "default": null 10 | } 11 | }, 12 | "required": [ 13 | "unit_type" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unit_type_untagged_enum.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "$ref": "#/components/schemas/AggregationRequest" 10 | }, 11 | { 12 | "default": null, 13 | "type": "null" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unnamed_struct_with_description_override.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "This is description from include_str!\n", 8 | "type": "string" 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unnamed_struct_with_self_reference.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "$ref": "#/components/schemas/Item" 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unnamed_structs_with_examples-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "$ref": "#/components/schemas/Username" 8 | } 9 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_unnamed_structs_with_examples.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: doc 4 | snapshot_kind: text 5 | --- 6 | { 7 | "examples": [ 8 | "kim", 9 | "jim" 10 | ], 11 | "type": "string" 12 | } 13 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__derive_untagged_with_unit_variant.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "oneOf": [ 8 | { 9 | "format": "int32", 10 | "type": "integer" 11 | }, 12 | { 13 | "default": null, 14 | "type": "null" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__new_type_struct_pattern.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "pattern": "^([a-zA-Z0-9_\\-]{3,32}$)", 8 | "type": "string" 9 | } 10 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__non_strict_integers.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "format": "int32", 10 | "maximum": 10, 11 | "minimum": 5, 12 | "multipleOf": 2.5, 13 | "type": "integer" 14 | }, 15 | "items": { 16 | "items": { 17 | "minLength": 1, 18 | "type": "string" 19 | }, 20 | "maxItems": 5, 21 | "minItems": 1, 22 | "type": "array" 23 | }, 24 | "unsigned": { 25 | "format": "u-int16", 26 | "minimum": 0, 27 | "type": "integer" 28 | }, 29 | "unsigned_value": { 30 | "format": "u-int32", 31 | "minimum": 2, 32 | "type": "integer" 33 | }, 34 | "value": { 35 | "maxLength": 10, 36 | "minLength": 5, 37 | "pattern": "[a-z]*", 38 | "type": "string" 39 | } 40 | }, 41 | "required": [ 42 | "id", 43 | "value", 44 | "items", 45 | "unsigned", 46 | "unsigned_value" 47 | ], 48 | "type": "object" 49 | } 50 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__schema_manual_impl.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "customer": { 9 | "$ref": "#/components/schemas/Newtype" 10 | } 11 | }, 12 | "required": [ 13 | "customer" 14 | ], 15 | "type": "object" 16 | } 17 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__strict_integers.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "id": { 9 | "format": "int32", 10 | "maximum": 10, 11 | "minimum": 5, 12 | "multipleOf": 2.5, 13 | "type": "integer" 14 | }, 15 | "items": { 16 | "items": { 17 | "minLength": 1, 18 | "type": "string" 19 | }, 20 | "maxItems": 5, 21 | "minItems": 1, 22 | "type": "array" 23 | }, 24 | "unsigned": { 25 | "format": "int32", 26 | "minimum": 0, 27 | "type": "integer" 28 | }, 29 | "unsigned_value": { 30 | "format": "int32", 31 | "minimum": 2, 32 | "type": "integer" 33 | }, 34 | "value": { 35 | "maxLength": 10, 36 | "minLength": 5, 37 | "pattern": "[a-z]*", 38 | "type": "string" 39 | } 40 | }, 41 | "required": [ 42 | "id", 43 | "value", 44 | "items", 45 | "unsigned", 46 | "unsigned_value" 47 | ], 48 | "type": "object" 49 | } 50 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__uint_non_strict_integers_format.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "properties": { 8 | "i16": { 9 | "format": "u-int16", 10 | "type": "string" 11 | }, 12 | "i8": { 13 | "format": "int8", 14 | "type": "string" 15 | }, 16 | "ui16": { 17 | "format": "u-int16", 18 | "type": "string" 19 | }, 20 | "ui32": { 21 | "format": "u-int32", 22 | "type": "string" 23 | }, 24 | "ui64": { 25 | "format": "u-int64", 26 | "type": "string" 27 | }, 28 | "ui8": { 29 | "format": "u-int8", 30 | "type": "string" 31 | } 32 | }, 33 | "required": [ 34 | "ui8", 35 | "ui16", 36 | "ui32", 37 | "ui64", 38 | "i16", 39 | "i8" 40 | ], 41 | "type": "object" 42 | } 43 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_derive_test__unit_struct_schema.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_derive_test.rs 3 | expression: value 4 | snapshot_kind: text 5 | --- 6 | { 7 | "default": null, 8 | "description": "This is description", 9 | "title": "Title" 10 | } 11 | -------------------------------------------------------------------------------- /utoipa-gen/tests/snapshots/schema_generics__uuid_type_generic_argument.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa-gen/tests/schema_generics.rs 3 | expression: api 4 | snapshot_kind: text 5 | --- 6 | { 7 | "openapi": "3.1.0", 8 | "info": { 9 | "title": "title", 10 | "version": "version" 11 | }, 12 | "paths": {}, 13 | "components": { 14 | "schemas": { 15 | "HighUuid": { 16 | "$ref": "#/components/schemas/High_Option_String" 17 | }, 18 | "High_Option_String": { 19 | "type": "object", 20 | "required": [ 21 | "high" 22 | ], 23 | "properties": { 24 | "high": { 25 | "oneOf": [ 26 | { 27 | "type": "null" 28 | }, 29 | { 30 | "type": "string" 31 | } 32 | ] 33 | } 34 | } 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /utoipa-gen/tests/testdata/description_override: -------------------------------------------------------------------------------- 1 | This is description from include_str! 2 | -------------------------------------------------------------------------------- /utoipa-gen/tests/testdata/openapi-derive-info-description: -------------------------------------------------------------------------------- 1 | this is include description 2 | -------------------------------------------------------------------------------- /utoipa-rapidoc/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-rapidoc/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-rapidoc/res/rapidoc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /utoipa-redoc/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-redoc/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-redoc/res/redoc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redoc 5 | 6 | 7 | 11 | 12 | 18 | 19 | 20 | 21 |
22 | 23 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /utoipa-redoc/src/actix.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "actix-web")] 2 | 3 | use actix_web::dev::HttpServiceFactory; 4 | use actix_web::guard::Get; 5 | use actix_web::web::Data; 6 | use actix_web::{HttpResponse, Resource, Responder}; 7 | 8 | use crate::{Redoc, Spec}; 9 | 10 | impl HttpServiceFactory for Redoc { 11 | fn register(self, config: &mut actix_web::dev::AppService) { 12 | let html = self.to_html(); 13 | 14 | async fn serve_redoc(redoc: Data) -> impl Responder { 15 | HttpResponse::Ok() 16 | .content_type("text/html") 17 | .body(redoc.to_string()) 18 | } 19 | 20 | Resource::new(self.url.as_ref()) 21 | .guard(Get()) 22 | .app_data(Data::new(html)) 23 | .to(serve_redoc) 24 | .register(config); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-redoc/src/axum.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "axum")] 2 | 3 | use axum::response::Html; 4 | use axum::{routing, Router}; 5 | 6 | use crate::{Redoc, Spec}; 7 | 8 | impl From> for Router 9 | where 10 | R: Clone + Send + Sync + 'static, 11 | { 12 | fn from(value: Redoc) -> Self { 13 | let html = value.to_html(); 14 | Router::::new().route( 15 | value.url.as_ref(), 16 | routing::get(move || async { Html(html) }), 17 | ) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-redoc/src/rocket.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "rocket")] 2 | 3 | use rocket::http::Method; 4 | use rocket::response::content::RawHtml; 5 | use rocket::route::{Handler, Outcome}; 6 | use rocket::{Data, Request, Route}; 7 | 8 | use crate::{Redoc, Spec}; 9 | 10 | impl From> for Vec { 11 | fn from(value: Redoc) -> Self { 12 | vec![Route::new( 13 | Method::Get, 14 | value.url.as_ref(), 15 | RedocHandler(value.to_html()), 16 | )] 17 | } 18 | } 19 | 20 | #[derive(Clone)] 21 | struct RedocHandler(String); 22 | 23 | #[rocket::async_trait] 24 | impl Handler for RedocHandler { 25 | async fn handle<'r>(&self, request: &'r Request<'_>, _: Data<'r>) -> Outcome<'r> { 26 | Outcome::from(request, RawHtml(self.0.clone())) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-scalar/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-scalar/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-scalar/res/scalar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Scalar 5 | 6 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /utoipa-scalar/src/actix.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "actix-web")] 2 | 3 | use actix_web::dev::HttpServiceFactory; 4 | use actix_web::guard::Get; 5 | use actix_web::web::Data; 6 | use actix_web::{HttpResponse, Resource, Responder}; 7 | 8 | use crate::{Scalar, Spec}; 9 | 10 | impl HttpServiceFactory for Scalar { 11 | fn register(self, config: &mut actix_web::dev::AppService) { 12 | let html = self.to_html(); 13 | 14 | async fn serve_scalar(scalar: Data) -> impl Responder { 15 | HttpResponse::Ok() 16 | .content_type("text/html") 17 | .body(scalar.to_string()) 18 | } 19 | 20 | Resource::new(self.url.as_ref()) 21 | .guard(Get()) 22 | .app_data(Data::new(html)) 23 | .to(serve_scalar) 24 | .register(config); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /utoipa-scalar/src/axum.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "axum")] 2 | 3 | use axum::response::Html; 4 | use axum::{routing, Router}; 5 | 6 | use crate::{Scalar, Spec}; 7 | 8 | impl From> for Router 9 | where 10 | R: Clone + Send + Sync + 'static, 11 | { 12 | fn from(value: Scalar) -> Self { 13 | let html = value.to_html(); 14 | Router::::new().route( 15 | value.url.as_ref(), 16 | routing::get(move || async { Html(html) }), 17 | ) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /utoipa-scalar/src/rocket.rs: -------------------------------------------------------------------------------- 1 | #![cfg(feature = "rocket")] 2 | 3 | use rocket::http::Method; 4 | use rocket::response::content::RawHtml; 5 | use rocket::route::{Handler, Outcome}; 6 | use rocket::{Data, Request, Route}; 7 | 8 | use crate::{Scalar, Spec}; 9 | 10 | impl From> for Vec { 11 | fn from(value: Scalar) -> Self { 12 | vec![Route::new( 13 | Method::Get, 14 | value.url.as_ref(), 15 | ScalarHandler(value.to_html()), 16 | )] 17 | } 18 | } 19 | 20 | #[derive(Clone)] 21 | struct ScalarHandler(String); 22 | 23 | #[rocket::async_trait] 24 | impl Handler for ScalarHandler { 25 | async fn handle<'r>(&self, request: &'r Request<'_>, _: Data<'r>) -> Outcome<'r> { 26 | Outcome::from(request, RawHtml(self.0.clone())) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog - utoipa-swagger-ui-vendored 2 | 3 | ## 0.1.2 - Oct 16 2024 4 | 5 | ### Fixed 6 | 7 | * Fix utoipa-swagger-ui-vendored crates link 8 | 9 | ### Changed 10 | 11 | * Update Swagger UI with latest release 5.7.14 (https://github.com/juhaku/utoipa/pull/1142) 12 | * Remove commit commit id from changelogs (https://github.com/juhaku/utoipa/pull/1077) 13 | 14 | ## 0.1.1 - May 22 2024 15 | 16 | ### Added 17 | 18 | * Add vendored Swagger UI for utoipa (https://github.com/juhaku/utoipa/pull/941) 19 | 20 | ### Changed 21 | 22 | * Update utoipa-swagger-ui-vendored version 23 | * Include res for crates 24 | 25 | -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "utoipa-swagger-ui-vendored" 3 | description = "Vendored Swagger UI for utoipa" 4 | license = "MIT OR Apache-2.0" 5 | readme = "README.md" 6 | version = "0.1.2" 7 | edition = "2021" 8 | keywords = ["swagger-ui", "vendored", "openapi", "documentation"] 9 | repository = "https://github.com/juhaku/utoipa" 10 | categories = ["web-programming"] 11 | authors = ["Juha Kukkonen "] 12 | rust-version.workspace = true 13 | 14 | [dependencies] 15 | -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/res/v5.17.14.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/juhaku/utoipa/7bde710045c677f4d2b02113cfa6a57bdf392fe0/utoipa-swagger-ui-vendored/res/v5.17.14.zip -------------------------------------------------------------------------------- /utoipa-swagger-ui-vendored/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! This crate holds the [Swagger UI](https://github.com/swagger-api/swagger-ui) zip archive re-packaged as 2 | //! Rust crate. The crate serves as a build dependency for `utoipa-swagger-ui` and is used to serve the 3 | //! Swagger UI when `vendored` crate feature is enabled for `utoipa-swagger-ui` crate. 4 | //! 5 | //! Vendored Swagger UI provides the means to serve Swagger UI in sandboxed environments where network access or 6 | //! even other means to provide Swagger UI is not possible. 7 | //! 8 | //! **Swagger UI version: `5.17.14`** 9 | //! 10 | //! ## License 11 | //! 12 | //! Licensed under either of [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) license at your option. 13 | //! 14 | //! Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate 15 | //! by you, shall be dual licensed, without any additional terms or conditions. 16 | 17 | /// Swagger UI zip bytes 18 | #[doc(hidden)] 19 | pub const SWAGGER_UI_VENDORED: &[u8] = std::include_bytes!("../res/v5.17.14.zip"); 20 | -------------------------------------------------------------------------------- /utoipa-swagger-ui/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa-swagger-ui/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa/LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | ../LICENSE-APACHE -------------------------------------------------------------------------------- /utoipa/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | ../LICENSE-MIT -------------------------------------------------------------------------------- /utoipa/README.md: -------------------------------------------------------------------------------- 1 | ../README.md -------------------------------------------------------------------------------- /utoipa/src/gen.rs: -------------------------------------------------------------------------------- 1 | pub use serde_json; 2 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__request_body__openapi_extensions_tests__request_body_builder_ext.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/request_body.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/EmailPayload" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__request_body__openapi_extensions_tests__request_body_ext.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/request_body.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "content": { 8 | "application/json": { 9 | "schema": { 10 | "$ref": "#/components/schemas/EmailPayload" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__request_body__tests__request_body_builder.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/request_body.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "A sample requestBody", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/EmailPayload" 12 | } 13 | } 14 | }, 15 | "required": true 16 | } 17 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__response__openapi_extensions_tests__response_builder_ext.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/response.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "A sample response", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/MySchemaPayload" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__response__openapi_extensions_tests__response_ext.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/response.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "A sample response", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/MySchemaPayload" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utoipa/src/openapi/snapshots/utoipa__openapi__response__tests__response_builder.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi/response.rs 3 | expression: request_body 4 | snapshot_kind: text 5 | --- 6 | { 7 | "description": "A sample response", 8 | "content": { 9 | "application/json": { 10 | "schema": { 11 | "$ref": "#/components/schemas/MySchemaPayload" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /utoipa/src/snapshots/utoipa__openapi__tests__nest_open_apis.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi.rs 3 | expression: paths 4 | snapshot_kind: text 5 | --- 6 | { 7 | "/api/v1/status": { 8 | "get": { 9 | "description": "Get status", 10 | "responses": {} 11 | } 12 | }, 13 | "/api/v1/user/": { 14 | "get": { 15 | "description": "Get user details", 16 | "responses": {} 17 | } 18 | }, 19 | "/api/v1/user/foo": { 20 | "post": { 21 | "responses": {} 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /utoipa/src/snapshots/utoipa__openapi__tests__openapi_custom_extension.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi.rs 3 | expression: api 4 | snapshot_kind: text 5 | --- 6 | { 7 | "openapi": "3.1.0", 8 | "info": { 9 | "title": "", 10 | "version": "" 11 | }, 12 | "paths": {}, 13 | "x-tagGroup": "anything that serializes to Json" 14 | } 15 | -------------------------------------------------------------------------------- /utoipa/src/snapshots/utoipa__openapi__tests__serialize_openapi_json_minimal_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi.rs 3 | expression: openapi 4 | snapshot_kind: text 5 | --- 6 | { 7 | "openapi": "3.1.0", 8 | "info": { 9 | "title": "My api", 10 | "description": "My api description", 11 | "license": { 12 | "name": "MIT", 13 | "url": "http://mit.licence" 14 | }, 15 | "version": "1.0.0" 16 | }, 17 | "paths": {} 18 | } 19 | -------------------------------------------------------------------------------- /utoipa/src/snapshots/utoipa__openapi__tests__serialize_openapi_json_with_paths_success.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: utoipa/src/openapi.rs 3 | expression: openapi 4 | snapshot_kind: text 5 | --- 6 | { 7 | "openapi": "3.1.0", 8 | "info": { 9 | "title": "My big api", 10 | "version": "1.1.0" 11 | }, 12 | "paths": { 13 | "/api/v1/users": { 14 | "get": { 15 | "responses": { 16 | "200": { 17 | "description": "Get users list" 18 | } 19 | } 20 | }, 21 | "post": { 22 | "responses": { 23 | "200": { 24 | "description": "Post new user" 25 | } 26 | } 27 | } 28 | }, 29 | "/api/v1/users/{id}": { 30 | "get": { 31 | "responses": { 32 | "200": { 33 | "description": "Get user by id" 34 | } 35 | } 36 | } 37 | } 38 | } 39 | } 40 | --------------------------------------------------------------------------------