Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit 3df55f0

Browse files
authored
v2 adds wildcard responses (#151)
* Adds generation of wildcard responses * Uses wildcars responses in deserialization * Uses ranged response dict * Fixes endpoint test syntax error * Fixes operation test init generation, removes unneeded response body union, adds test * Adds OperationFeatures * Fixes java test * Updates docs * Samples regenerated
1 parent c883b75 commit 3df55f0

File tree

635 files changed

+1995
-29183
lines changed
  • docs/generators
  • modules
  • samples/openapi3/client
    • 3_0_3_unit_test/python
      • src/unit_test_api/paths
        • request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post
        • request_body_post_additionalproperties_are_allowed_by_default_request_body/post
        • request_body_post_additionalproperties_can_exist_by_itself_request_body/post
        • request_body_post_additionalproperties_should_not_look_in_applicators_request_body/post
        • request_body_post_allof_combined_with_anyof_oneof_request_body/post
        • request_body_post_allof_request_body/post
        • request_body_post_allof_simple_types_request_body/post
        • request_body_post_allof_with_base_schema_request_body/post
        • request_body_post_allof_with_one_empty_schema_request_body/post
        • request_body_post_allof_with_the_first_empty_schema_request_body/post
        • request_body_post_allof_with_the_last_empty_schema_request_body/post
        • request_body_post_allof_with_two_empty_schemas_request_body/post
        • request_body_post_anyof_complex_types_request_body/post
        • request_body_post_anyof_request_body/post
        • request_body_post_anyof_with_base_schema_request_body/post
        • request_body_post_anyof_with_one_empty_schema_request_body/post
        • request_body_post_array_type_matches_arrays_request_body/post
        • request_body_post_boolean_type_matches_booleans_request_body/post
        • request_body_post_by_int_request_body/post
        • request_body_post_by_number_request_body/post
        • request_body_post_by_small_number_request_body/post
        • request_body_post_date_time_format_request_body/post
        • request_body_post_email_format_request_body/post
        • request_body_post_enum_with0_does_not_match_false_request_body/post
        • request_body_post_enum_with1_does_not_match_true_request_body/post
        • request_body_post_enum_with_escaped_characters_request_body/post
        • request_body_post_enum_with_false_does_not_match0_request_body/post
        • request_body_post_enum_with_true_does_not_match1_request_body/post
        • request_body_post_enums_in_properties_request_body/post
        • request_body_post_forbidden_property_request_body/post
        • request_body_post_hostname_format_request_body/post
        • request_body_post_integer_type_matches_integers_request_body/post
        • request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body/post
        • request_body_post_invalid_string_value_for_default_request_body/post
        • request_body_post_ipv4_format_request_body/post
        • request_body_post_ipv6_format_request_body/post
        • request_body_post_json_pointer_format_request_body/post
        • request_body_post_maximum_validation_request_body/post
        • request_body_post_maximum_validation_with_unsigned_integer_request_body/post
        • request_body_post_maxitems_validation_request_body/post
        • request_body_post_maxlength_validation_request_body/post
        • request_body_post_maxproperties0_means_the_object_is_empty_request_body/post
        • request_body_post_maxproperties_validation_request_body/post
        • request_body_post_minimum_validation_request_body/post
        • request_body_post_minimum_validation_with_signed_integer_request_body/post
        • request_body_post_minitems_validation_request_body/post
        • request_body_post_minlength_validation_request_body/post
        • request_body_post_minproperties_validation_request_body/post
        • request_body_post_nested_allof_to_check_validation_semantics_request_body/post
        • request_body_post_nested_anyof_to_check_validation_semantics_request_body/post
        • request_body_post_nested_items_request_body/post
        • request_body_post_nested_oneof_to_check_validation_semantics_request_body/post
        • request_body_post_not_more_complex_schema_request_body/post
        • request_body_post_not_request_body/post
        • request_body_post_nul_characters_in_strings_request_body/post
        • request_body_post_null_type_matches_only_the_null_object_request_body/post
        • request_body_post_number_type_matches_numbers_request_body/post
        • request_body_post_object_properties_validation_request_body/post
        • request_body_post_object_type_matches_objects_request_body/post
        • request_body_post_oneof_complex_types_request_body/post
        • request_body_post_oneof_request_body/post
        • request_body_post_oneof_with_base_schema_request_body/post
        • request_body_post_oneof_with_empty_schema_request_body/post
        • request_body_post_oneof_with_required_request_body/post
        • request_body_post_pattern_is_not_anchored_request_body/post
        • request_body_post_pattern_validation_request_body/post
        • request_body_post_properties_with_escaped_characters_request_body/post
        • request_body_post_property_named_ref_that_is_not_a_reference_request_body/post
        • request_body_post_ref_in_additionalproperties_request_body/post
        • request_body_post_ref_in_allof_request_body/post
        • request_body_post_ref_in_anyof_request_body/post
        • request_body_post_ref_in_items_request_body/post
        • request_body_post_ref_in_not_request_body/post
        • request_body_post_ref_in_oneof_request_body/post
        • request_body_post_ref_in_property_request_body/post
        • request_body_post_required_default_validation_request_body/post
        • request_body_post_required_validation_request_body/post
        • request_body_post_required_with_empty_array_request_body/post
        • request_body_post_required_with_escaped_characters_request_body/post
        • request_body_post_simple_enum_validation_request_body/post
        • request_body_post_string_type_matches_strings_request_body/post
        • request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body/post
        • request_body_post_uniqueitems_false_validation_request_body/post
        • request_body_post_uniqueitems_validation_request_body/post
        • request_body_post_uri_format_request_body/post
        • request_body_post_uri_reference_format_request_body/post
        • request_body_post_uri_template_format_request_body/post
        • response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types/post
        • response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types/post
        • response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types/post
        • response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types/post
        • response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types/post
        • response_body_post_allof_response_body_for_content_types/post
        • response_body_post_allof_simple_types_response_body_for_content_types/post
        • response_body_post_allof_with_base_schema_response_body_for_content_types/post
        • response_body_post_allof_with_one_empty_schema_response_body_for_content_types/post
        • response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types/post
        • response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types/post
        • response_body_post_allof_with_two_empty_schemas_response_body_for_content_types/post
        • response_body_post_anyof_complex_types_response_body_for_content_types/post
        • response_body_post_anyof_response_body_for_content_types/post
        • response_body_post_anyof_with_base_schema_response_body_for_content_types/post
        • response_body_post_anyof_with_one_empty_schema_response_body_for_content_types/post
        • response_body_post_array_type_matches_arrays_response_body_for_content_types/post
        • response_body_post_boolean_type_matches_booleans_response_body_for_content_types/post
        • response_body_post_by_int_response_body_for_content_types/post
        • response_body_post_by_number_response_body_for_content_types/post
        • response_body_post_by_small_number_response_body_for_content_types/post
        • response_body_post_date_time_format_response_body_for_content_types/post
        • response_body_post_email_format_response_body_for_content_types/post
        • response_body_post_enum_with0_does_not_match_false_response_body_for_content_types/post
        • response_body_post_enum_with1_does_not_match_true_response_body_for_content_types/post
        • response_body_post_enum_with_escaped_characters_response_body_for_content_types/post
        • response_body_post_enum_with_false_does_not_match0_response_body_for_content_types/post
        • response_body_post_enum_with_true_does_not_match1_response_body_for_content_types/post
        • response_body_post_enums_in_properties_response_body_for_content_types/post
        • response_body_post_forbidden_property_response_body_for_content_types/post
        • response_body_post_hostname_format_response_body_for_content_types/post
        • response_body_post_integer_type_matches_integers_response_body_for_content_types/post
        • response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types/post
        • response_body_post_invalid_string_value_for_default_response_body_for_content_types/post
        • response_body_post_ipv4_format_response_body_for_content_types/post
        • response_body_post_ipv6_format_response_body_for_content_types/post
        • response_body_post_json_pointer_format_response_body_for_content_types/post
        • response_body_post_maximum_validation_response_body_for_content_types/post
        • response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types/post
        • response_body_post_maxitems_validation_response_body_for_content_types/post
        • response_body_post_maxlength_validation_response_body_for_content_types/post
        • response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types/post
        • response_body_post_maxproperties_validation_response_body_for_content_types/post
        • response_body_post_minimum_validation_response_body_for_content_types/post
        • response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types/post
        • response_body_post_minitems_validation_response_body_for_content_types/post
        • response_body_post_minlength_validation_response_body_for_content_types/post
        • response_body_post_minproperties_validation_response_body_for_content_types/post
        • response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types/post
        • response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types/post
        • response_body_post_nested_items_response_body_for_content_types/post
        • response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types/post
        • response_body_post_not_more_complex_schema_response_body_for_content_types/post
        • response_body_post_not_response_body_for_content_types/post
        • response_body_post_nul_characters_in_strings_response_body_for_content_types/post
        • response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types/post
        • response_body_post_number_type_matches_numbers_response_body_for_content_types/post
        • response_body_post_object_properties_validation_response_body_for_content_types/post
        • response_body_post_object_type_matches_objects_response_body_for_content_types/post
        • response_body_post_oneof_complex_types_response_body_for_content_types/post
        • response_body_post_oneof_response_body_for_content_types/post
        • response_body_post_oneof_with_base_schema_response_body_for_content_types/post
        • response_body_post_oneof_with_empty_schema_response_body_for_content_types/post
        • response_body_post_oneof_with_required_response_body_for_content_types/post
        • response_body_post_pattern_is_not_anchored_response_body_for_content_types/post
        • response_body_post_pattern_validation_response_body_for_content_types/post
        • response_body_post_properties_with_escaped_characters_response_body_for_content_types/post
        • response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types/post
        • response_body_post_ref_in_additionalproperties_response_body_for_content_types/post
        • response_body_post_ref_in_allof_response_body_for_content_types/post
        • response_body_post_ref_in_anyof_response_body_for_content_types/post
        • response_body_post_ref_in_items_response_body_for_content_types/post
        • response_body_post_ref_in_not_response_body_for_content_types/post
        • response_body_post_ref_in_oneof_response_body_for_content_types/post
        • response_body_post_ref_in_property_response_body_for_content_types/post
        • response_body_post_required_default_validation_response_body_for_content_types/post
        • response_body_post_required_validation_response_body_for_content_types/post
        • response_body_post_required_with_empty_array_response_body_for_content_types/post
        • response_body_post_required_with_escaped_characters_response_body_for_content_types/post
        • response_body_post_simple_enum_validation_response_body_for_content_types/post
        • response_body_post_string_type_matches_strings_response_body_for_content_types/post
        • response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types/post
        • response_body_post_uniqueitems_false_validation_response_body_for_content_types/post
        • response_body_post_uniqueitems_validation_response_body_for_content_types/post
        • response_body_post_uri_format_response_body_for_content_types/post
        • response_body_post_uri_reference_format_response_body_for_content_types/post
        • response_body_post_uri_template_format_response_body_for_content_types/post
      • test/test_paths
        • test_request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body
        • test_request_body_post_additionalproperties_are_allowed_by_default_request_body
        • test_request_body_post_additionalproperties_can_exist_by_itself_request_body
        • test_request_body_post_additionalproperties_should_not_look_in_applicators_request_body
        • test_request_body_post_allof_combined_with_anyof_oneof_request_body
        • test_request_body_post_allof_request_body
        • test_request_body_post_allof_simple_types_request_body
        • test_request_body_post_allof_with_base_schema_request_body
        • test_request_body_post_allof_with_one_empty_schema_request_body
        • test_request_body_post_allof_with_the_first_empty_schema_request_body
        • test_request_body_post_allof_with_the_last_empty_schema_request_body
        • test_request_body_post_allof_with_two_empty_schemas_request_body
        • test_request_body_post_anyof_complex_types_request_body
        • test_request_body_post_anyof_request_body
        • test_request_body_post_anyof_with_base_schema_request_body
        • test_request_body_post_anyof_with_one_empty_schema_request_body
        • test_request_body_post_array_type_matches_arrays_request_body
        • test_request_body_post_boolean_type_matches_booleans_request_body
        • test_request_body_post_by_int_request_body
        • test_request_body_post_by_number_request_body
        • test_request_body_post_by_small_number_request_body
        • test_request_body_post_date_time_format_request_body
        • test_request_body_post_email_format_request_body
        • test_request_body_post_enum_with0_does_not_match_false_request_body
        • test_request_body_post_enum_with1_does_not_match_true_request_body
        • test_request_body_post_enum_with_escaped_characters_request_body
        • test_request_body_post_enum_with_false_does_not_match0_request_body
        • test_request_body_post_enum_with_true_does_not_match1_request_body
        • test_request_body_post_enums_in_properties_request_body
        • test_request_body_post_forbidden_property_request_body
        • test_request_body_post_hostname_format_request_body
        • test_request_body_post_integer_type_matches_integers_request_body
        • test_request_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_request_body
        • test_request_body_post_invalid_string_value_for_default_request_body
        • test_request_body_post_ipv4_format_request_body
        • test_request_body_post_ipv6_format_request_body
        • test_request_body_post_json_pointer_format_request_body
        • test_request_body_post_maximum_validation_request_body
        • test_request_body_post_maximum_validation_with_unsigned_integer_request_body
        • test_request_body_post_maxitems_validation_request_body
        • test_request_body_post_maxlength_validation_request_body
        • test_request_body_post_maxproperties0_means_the_object_is_empty_request_body
        • test_request_body_post_maxproperties_validation_request_body
        • test_request_body_post_minimum_validation_request_body
        • test_request_body_post_minimum_validation_with_signed_integer_request_body
        • test_request_body_post_minitems_validation_request_body
        • test_request_body_post_minlength_validation_request_body
        • test_request_body_post_minproperties_validation_request_body
        • test_request_body_post_nested_allof_to_check_validation_semantics_request_body
        • test_request_body_post_nested_anyof_to_check_validation_semantics_request_body
        • test_request_body_post_nested_items_request_body
        • test_request_body_post_nested_oneof_to_check_validation_semantics_request_body
        • test_request_body_post_not_more_complex_schema_request_body
        • test_request_body_post_not_request_body
        • test_request_body_post_nul_characters_in_strings_request_body
        • test_request_body_post_null_type_matches_only_the_null_object_request_body
        • test_request_body_post_number_type_matches_numbers_request_body
        • test_request_body_post_object_properties_validation_request_body
        • test_request_body_post_object_type_matches_objects_request_body
        • test_request_body_post_oneof_complex_types_request_body
        • test_request_body_post_oneof_request_body
        • test_request_body_post_oneof_with_base_schema_request_body
        • test_request_body_post_oneof_with_empty_schema_request_body
        • test_request_body_post_oneof_with_required_request_body
        • test_request_body_post_pattern_is_not_anchored_request_body
        • test_request_body_post_pattern_validation_request_body
        • test_request_body_post_properties_with_escaped_characters_request_body
        • test_request_body_post_property_named_ref_that_is_not_a_reference_request_body
        • test_request_body_post_ref_in_additionalproperties_request_body
        • test_request_body_post_ref_in_allof_request_body
        • test_request_body_post_ref_in_anyof_request_body
        • test_request_body_post_ref_in_items_request_body
        • test_request_body_post_ref_in_not_request_body
        • test_request_body_post_ref_in_oneof_request_body
        • test_request_body_post_ref_in_property_request_body
        • test_request_body_post_required_default_validation_request_body
        • test_request_body_post_required_validation_request_body
        • test_request_body_post_required_with_empty_array_request_body
        • test_request_body_post_required_with_escaped_characters_request_body
        • test_request_body_post_simple_enum_validation_request_body
        • test_request_body_post_string_type_matches_strings_request_body
        • test_request_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_request_body
        • test_request_body_post_uniqueitems_false_validation_request_body
        • test_request_body_post_uniqueitems_validation_request_body
        • test_request_body_post_uri_format_request_body
        • test_request_body_post_uri_reference_format_request_body
        • test_request_body_post_uri_template_format_request_body
        • test_response_body_post_additionalproperties_allows_a_schema_which_should_validate_response_body_for_content_types
        • test_response_body_post_additionalproperties_are_allowed_by_default_response_body_for_content_types
        • test_response_body_post_additionalproperties_can_exist_by_itself_response_body_for_content_types
        • test_response_body_post_additionalproperties_should_not_look_in_applicators_response_body_for_content_types
        • test_response_body_post_allof_combined_with_anyof_oneof_response_body_for_content_types
        • test_response_body_post_allof_response_body_for_content_types
        • test_response_body_post_allof_simple_types_response_body_for_content_types
        • test_response_body_post_allof_with_base_schema_response_body_for_content_types
        • test_response_body_post_allof_with_one_empty_schema_response_body_for_content_types
        • test_response_body_post_allof_with_the_first_empty_schema_response_body_for_content_types
        • test_response_body_post_allof_with_the_last_empty_schema_response_body_for_content_types
        • test_response_body_post_allof_with_two_empty_schemas_response_body_for_content_types
        • test_response_body_post_anyof_complex_types_response_body_for_content_types
        • test_response_body_post_anyof_response_body_for_content_types
        • test_response_body_post_anyof_with_base_schema_response_body_for_content_types
        • test_response_body_post_anyof_with_one_empty_schema_response_body_for_content_types
        • test_response_body_post_array_type_matches_arrays_response_body_for_content_types
        • test_response_body_post_boolean_type_matches_booleans_response_body_for_content_types
        • test_response_body_post_by_int_response_body_for_content_types
        • test_response_body_post_by_number_response_body_for_content_types
        • test_response_body_post_by_small_number_response_body_for_content_types
        • test_response_body_post_date_time_format_response_body_for_content_types
        • test_response_body_post_email_format_response_body_for_content_types
        • test_response_body_post_enum_with0_does_not_match_false_response_body_for_content_types
        • test_response_body_post_enum_with1_does_not_match_true_response_body_for_content_types
        • test_response_body_post_enum_with_escaped_characters_response_body_for_content_types
        • test_response_body_post_enum_with_false_does_not_match0_response_body_for_content_types
        • test_response_body_post_enum_with_true_does_not_match1_response_body_for_content_types
        • test_response_body_post_enums_in_properties_response_body_for_content_types
        • test_response_body_post_forbidden_property_response_body_for_content_types
        • test_response_body_post_hostname_format_response_body_for_content_types
        • test_response_body_post_integer_type_matches_integers_response_body_for_content_types
        • test_response_body_post_invalid_instance_should_not_raise_error_when_float_division_inf_response_body_for_content_types
        • test_response_body_post_invalid_string_value_for_default_response_body_for_content_types
        • test_response_body_post_ipv4_format_response_body_for_content_types
        • test_response_body_post_ipv6_format_response_body_for_content_types
        • test_response_body_post_json_pointer_format_response_body_for_content_types
        • test_response_body_post_maximum_validation_response_body_for_content_types
        • test_response_body_post_maximum_validation_with_unsigned_integer_response_body_for_content_types
        • test_response_body_post_maxitems_validation_response_body_for_content_types
        • test_response_body_post_maxlength_validation_response_body_for_content_types
        • test_response_body_post_maxproperties0_means_the_object_is_empty_response_body_for_content_types
        • test_response_body_post_maxproperties_validation_response_body_for_content_types
        • test_response_body_post_minimum_validation_response_body_for_content_types
        • test_response_body_post_minimum_validation_with_signed_integer_response_body_for_content_types
        • test_response_body_post_minitems_validation_response_body_for_content_types
        • test_response_body_post_minlength_validation_response_body_for_content_types
        • test_response_body_post_minproperties_validation_response_body_for_content_types
        • test_response_body_post_nested_allof_to_check_validation_semantics_response_body_for_content_types
        • test_response_body_post_nested_anyof_to_check_validation_semantics_response_body_for_content_types
        • test_response_body_post_nested_items_response_body_for_content_types
        • test_response_body_post_nested_oneof_to_check_validation_semantics_response_body_for_content_types
        • test_response_body_post_not_more_complex_schema_response_body_for_content_types
        • test_response_body_post_not_response_body_for_content_types
        • test_response_body_post_nul_characters_in_strings_response_body_for_content_types
        • test_response_body_post_null_type_matches_only_the_null_object_response_body_for_content_types
        • test_response_body_post_number_type_matches_numbers_response_body_for_content_types
        • test_response_body_post_object_properties_validation_response_body_for_content_types
        • test_response_body_post_object_type_matches_objects_response_body_for_content_types
        • test_response_body_post_oneof_complex_types_response_body_for_content_types
        • test_response_body_post_oneof_response_body_for_content_types
        • test_response_body_post_oneof_with_base_schema_response_body_for_content_types
        • test_response_body_post_oneof_with_empty_schema_response_body_for_content_types
        • test_response_body_post_oneof_with_required_response_body_for_content_types
        • test_response_body_post_pattern_is_not_anchored_response_body_for_content_types
        • test_response_body_post_pattern_validation_response_body_for_content_types
        • test_response_body_post_properties_with_escaped_characters_response_body_for_content_types
        • test_response_body_post_property_named_ref_that_is_not_a_reference_response_body_for_content_types
        • test_response_body_post_ref_in_additionalproperties_response_body_for_content_types
        • test_response_body_post_ref_in_allof_response_body_for_content_types
        • test_response_body_post_ref_in_anyof_response_body_for_content_types
        • test_response_body_post_ref_in_items_response_body_for_content_types
        • test_response_body_post_ref_in_not_response_body_for_content_types
        • test_response_body_post_ref_in_oneof_response_body_for_content_types
        • test_response_body_post_ref_in_property_response_body_for_content_types
        • test_response_body_post_required_default_validation_response_body_for_content_types
        • test_response_body_post_required_validation_response_body_for_content_types
        • test_response_body_post_required_with_empty_array_response_body_for_content_types
        • test_response_body_post_required_with_escaped_characters_response_body_for_content_types
        • test_response_body_post_simple_enum_validation_response_body_for_content_types
        • test_response_body_post_string_type_matches_strings_response_body_for_content_types
        • test_response_body_post_the_default_keyword_does_not_do_anything_if_the_property_is_missing_response_body_for_content_types
        • test_response_body_post_uniqueitems_false_validation_response_body_for_content_types
        • test_response_body_post_uniqueitems_validation_response_body_for_content_types
        • test_response_body_post_uri_format_response_body_for_content_types
        • test_response_body_post_uri_reference_format_response_body_for_content_types
        • test_response_body_post_uri_template_format_response_body_for_content_types
    • features
    • petstore/python

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

635 files changed

+1995
-29183
lines changed

docs/generators/java.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
282282
|Tags|✗|OAS2,OAS3
283283
|ExternalDocs|✗|OAS2,OAS3
284284

285+
### Operation Feature
286+
| Name | Supported | Defined By |
287+
| ---- | --------- | ---------- |
288+
|Responses_HttpStatusCode|✓|OAS2,OAS3
289+
|Responses_RangedResponseCodes|✗|OAS2,OAS3
290+
|Responses_Default|✓|OAS2,OAS3
291+
285292
### Parameter Feature
286293
| Name | Supported | Defined By |
287294
| ---- | --------- | ---------- |

docs/generators/jaxrs-jersey.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
265265
|Tags|✗|OAS2,OAS3
266266
|ExternalDocs|✗|OAS2,OAS3
267267

268+
### Operation Feature
269+
| Name | Supported | Defined By |
270+
| ---- | --------- | ---------- |
271+
|Responses_HttpStatusCode|✓|OAS2,OAS3
272+
|Responses_RangedResponseCodes|✗|OAS2,OAS3
273+
|Responses_Default|✓|OAS2,OAS3
274+
268275
### Parameter Feature
269276
| Name | Supported | Defined By |
270277
| ---- | --------- | ---------- |

docs/generators/jmeter.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
124124
|Tags|✗|OAS2,OAS3
125125
|ExternalDocs|✗|OAS2,OAS3
126126

127+
### Operation Feature
128+
| Name | Supported | Defined By |
129+
| ---- | --------- | ---------- |
130+
|Responses_HttpStatusCode|✓|OAS2,OAS3
131+
|Responses_RangedResponseCodes|✗|OAS2,OAS3
132+
|Responses_Default|✓|OAS2,OAS3
133+
127134
### Parameter Feature
128135
| Name | Supported | Defined By |
129136
| ---- | --------- | ---------- |

docs/generators/kotlin.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
234234
|Tags|✗|OAS2,OAS3
235235
|ExternalDocs|✗|OAS2,OAS3
236236

237+
### Operation Feature
238+
| Name | Supported | Defined By |
239+
| ---- | --------- | ---------- |
240+
|Responses_HttpStatusCode|✓|OAS2,OAS3
241+
|Responses_RangedResponseCodes|✗|OAS2,OAS3
242+
|Responses_Default|✓|OAS2,OAS3
243+
237244
### Parameter Feature
238245
| Name | Supported | Defined By |
239246
| ---- | --------- | ---------- |

docs/generators/python.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ These options may be applied as additional-properties (cli) or configOptions (pl
193193
|Tags|✓|OAS2,OAS3
194194
|ExternalDocs|✗|OAS2,OAS3
195195

196+
### Operation Feature
197+
| Name | Supported | Defined By |
198+
| ---- | --------- | ---------- |
199+
|Responses_HttpStatusCode|✓|OAS2,OAS3
200+
|Responses_RangedResponseCodes|✓|OAS2,OAS3
201+
|Responses_Default|✓|OAS2,OAS3
202+
196203
### Parameter Feature
197204
| Name | Supported | Defined By |
198205
| ---- | --------- | ---------- |

modules/openapi-json-schema-generator-core/src/main/java/org/openapijsonschematools/codegen/meta/FeatureSet.java

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import org.openapijsonschematools.codegen.meta.features.DataTypeFeature;
2222
import org.openapijsonschematools.codegen.meta.features.DocumentationFeature;
2323
import org.openapijsonschematools.codegen.meta.features.GlobalFeature;
24+
import org.openapijsonschematools.codegen.meta.features.OperationFeature;
2425
import org.openapijsonschematools.codegen.meta.features.ParameterFeature;
2526
import org.openapijsonschematools.codegen.meta.features.SchemaFeature;
2627
import org.openapijsonschematools.codegen.meta.features.SecurityFeature;
@@ -46,6 +47,7 @@ public class FeatureSet {
4647
private EnumSet<SchemaFeature> schemaFeatures;
4748
private EnumSet<ParameterFeature> parameterFeatures;
4849
private EnumSet<SecurityFeature> securityFeatures;
50+
private EnumSet<OperationFeature> operationFeatures;
4951
private EnumSet<WireFormatFeature> wireFormatFeatures;
5052

5153
private FeatureSet(Builder builder) {
@@ -59,6 +61,7 @@ private FeatureSet(Builder builder) {
5961
parameterFeatures = builder.parameterFeatures;
6062
securityFeatures = builder.securityFeatures;
6163
wireFormatFeatures = builder.wireFormatFeatures;
64+
operationFeatures = builder.operationFeatures;
6265
}
6366
}
6467

@@ -81,10 +84,19 @@ public static Builder newBuilder(FeatureSet copy) {
8184
builder.parameterFeatures = copy.getParameterFeatures();
8285
builder.securityFeatures = copy.getSecurityFeatures();
8386
builder.wireFormatFeatures = copy.getWireFormatFeatures();
87+
builder.operationFeatures = copy.getOperationFeatures();
8488
}
8589
return builder;
8690
}
8791

92+
public EnumSet<OperationFeature> getOperationFeatures() {
93+
if (operationFeatures != null) {
94+
return EnumSet.copyOf(operationFeatures);
95+
} else {
96+
return EnumSet.noneOf(OperationFeature.class);
97+
}
98+
}
99+
88100
/**
89101
* Returns the set of client modification features supported by the generator.
90102
*
@@ -354,6 +366,22 @@ public List<FeatureSetFlattened> flatten() {
354366

355367
states.add(state);
356368
});
369+
EnumSet.allOf(OperationFeature.class).forEach(feat -> {
370+
FeatureSetFlattened state = new FeatureSetFlattened();
371+
state.featureCategory = OperationFeature.class.getSimpleName();
372+
state.featureName = feat.name();
373+
state.isSupported = this.operationFeatures.contains(feat);
374+
375+
try {
376+
for (Annotation an : OperationFeature.class.getField(feat.name()).getAnnotations()) {
377+
state.source.add(AnnotationType.fromAnnotation(an.annotationType()));
378+
}
379+
} catch (NoSuchFieldException e) {
380+
e.printStackTrace();
381+
}
382+
383+
states.add(state);
384+
});
357385
EnumSet.allOf(WireFormatFeature.class).forEach(feat -> {
358386
FeatureSetFlattened state = new FeatureSetFlattened();
359387
state.featureCategory = WireFormatFeature.class.getSimpleName();
@@ -389,6 +417,8 @@ public static final class Builder {
389417
private EnumSet<SecurityFeature> securityFeatures;
390418
private EnumSet<WireFormatFeature> wireFormatFeatures;
391419

420+
private EnumSet<OperationFeature> operationFeatures;
421+
392422
private Builder() {
393423
this.clientModificationFeatures = EnumSet.noneOf(ClientModificationFeature.class);
394424
this.dataTypeFeatures = EnumSet.noneOf(DataTypeFeature.class);
@@ -399,6 +429,26 @@ private Builder() {
399429
this.globalFeatures = EnumSet.noneOf(GlobalFeature.class);
400430
this.componentsFeatures = EnumSet.noneOf(ComponentsFeature.class);
401431
this.wireFormatFeatures = EnumSet.noneOf(WireFormatFeature.class);
432+
this.operationFeatures = EnumSet.noneOf(OperationFeature.class);
433+
}
434+
435+
public Builder operationFeatures(EnumSet<OperationFeature> operationFeatures) {
436+
if (operationFeatures != null) {
437+
this.operationFeatures = operationFeatures;
438+
} else {
439+
this.operationFeatures = EnumSet.noneOf(OperationFeature.class);
440+
}
441+
return this;
442+
}
443+
444+
public Builder includeOperationFeatures(OperationFeature... operationFeature) {
445+
this.operationFeatures.addAll(Arrays.stream(operationFeature).collect(Collectors.toList()));
446+
return this;
447+
}
448+
449+
public Builder excludeOperationFeatures(OperationFeature... operationFeature) {
450+
this.operationFeatures.removeAll(Arrays.stream(operationFeature).collect(Collectors.toList()));
451+
return this;
402452
}
403453

404454
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.openapijsonschematools.codegen.meta.features;
18+
19+
import org.openapijsonschematools.codegen.meta.features.annotations.OAS2;
20+
import org.openapijsonschematools.codegen.meta.features.annotations.OAS3;
21+
22+
/**
23+
* Defines Operation features supported in the generated code.
24+
*/
25+
public enum OperationFeature {
26+
/**
27+
* Supports header-based basic http auth.
28+
*/
29+
@OAS2 @OAS3
30+
Responses_HttpStatusCode,
31+
32+
@OAS2 @OAS3
33+
Responses_RangedResponseCodes,
34+
35+
@OAS2 @OAS3
36+
Responses_Default,
37+
}

modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/DefaultCodegen.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.openapijsonschematools.codegen.meta.features.DataTypeFeature;
3939
import org.openapijsonschematools.codegen.meta.features.DocumentationFeature;
4040
import org.openapijsonschematools.codegen.meta.features.GlobalFeature;
41+
import org.openapijsonschematools.codegen.meta.features.OperationFeature;
4142
import org.openapijsonschematools.codegen.meta.features.ParameterFeature;
4243
import org.openapijsonschematools.codegen.meta.features.SchemaFeature;
4344
import org.openapijsonschematools.codegen.meta.features.SecurityFeature;
@@ -160,6 +161,9 @@ public class DefaultCodegen implements CodegenConfig {
160161
ParameterFeature.In_Path, ParameterFeature.In_Query, ParameterFeature.In_Header,
161162
ParameterFeature.In_Cookie
162163
)
164+
.includeOperationFeatures(
165+
OperationFeature.Responses_Default, OperationFeature.Responses_HttpStatusCode
166+
)
163167
.includeSecurityFeatures(
164168
SecurityFeature.ApiKey, SecurityFeature.HTTP_Basic, SecurityFeature.HTTP_Bearer,
165169
SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_Password,
@@ -3379,7 +3383,8 @@ private void updateComponentsFilepath(String[] pathPieces) {
33793383
}
33803384
} else if (pathPieces[2].equals("responses")) {
33813385
// #/components/responses/SuccessWithJsonApiResponse/headers
3382-
pathPieces[3] = toResponseModuleName(pathPieces[3], null);
3386+
String responseJsonPath = "#/components/responses/" + pathPieces[3];
3387+
pathPieces[3] = toResponseModuleName(pathPieces[3], responseJsonPath);
33833388

33843389
if (pathPieces.length < 6) {
33853390
return;
@@ -3407,6 +3412,7 @@ private void updatePathsFilepath(String[] pathPieces) {
34073412
return;
34083413
}
34093414
// #/paths/somePath
3415+
String path = pathPieces[2];
34103416
pathPieces[2] = toPathFilename(ModelUtils.decodeSlashes(pathPieces[2]), null);
34113417
if (pathPieces.length < 4) {
34123418
return;
@@ -3434,8 +3440,8 @@ private void updatePathsFilepath(String[] pathPieces) {
34343440
pathPieces[5] = toSecurityRequirementObjectFilename(pathPieces[5], null);
34353441
} else if (pathPieces[4].equals("responses")) {
34363442
// #/paths/user_login/get/responses/200 -> 200 -> response_200 -> length 6
3437-
pathPieces[5] = toResponseModuleName(pathPieces[5], null);
3438-
3443+
String responseJsonPath = "#/paths/" + path + "/" + pathPieces[3] + "/responses/" + pathPieces[5];
3444+
pathPieces[5] = toResponseModuleName(pathPieces[5], responseJsonPath);
34393445
if (pathPieces.length < 8) {
34403446
return;
34413447
}

modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/DefaultGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ private void generatePathItem(List<File> files, CodegenKey pathKey, CodegenPathI
451451
}
452452

453453
if (pathItem.operations != null) {
454+
String testInitFilename = filenameFromRoot(Arrays.asList("test", "test_paths", "test_" + pathKey.snakeCase, "__init__.py"));
455+
generateFile(new HashMap<>(), "__init__.hbs", testInitFilename, files, true, CodegenConstants.API_TESTS);
456+
454457
for (Map.Entry<CodegenKey, CodegenOperation> entry: pathItem.operations.entrySet()) {
455458
CodegenKey httpMethod = entry.getKey();
456459
CodegenOperation operation = entry.getValue();
@@ -533,9 +536,6 @@ private void generatePathItem(List<File> files, CodegenKey pathKey, CodegenPathI
533536
endpointTestMap.put("packageName", config.packageName());
534537
outputFilename = filenameFromRoot(Arrays.asList("test", "test_paths", "test_" + pathKey.snakeCase, "test_" + httpMethod.original + ".py"));
535538
generateFile(endpointTestMap, templateFile, outputFilename, files, true, CodegenConstants.API_TESTS);
536-
537-
outputFilename = filenameFromRoot(Arrays.asList("test", "test_paths", "test_" + pathKey.snakeCase, "__init__.py"));
538-
generateFile(endpointTestMap, templateFile, outputFilename, files, true, CodegenConstants.API_TESTS);
539539
}
540540
}
541541
}

modules/openapi-json-schema-generator/src/main/java/org/openapijsonschematools/codegen/languages/PythonClientCodegen.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.openapijsonschematools.codegen.CliOption;
2727
import org.openapijsonschematools.codegen.CodegenConstants;
2828
import org.openapijsonschematools.codegen.meta.features.ComponentsFeature;
29+
import org.openapijsonschematools.codegen.meta.features.OperationFeature;
2930
import org.openapijsonschematools.codegen.meta.features.SchemaFeature;
3031
import org.openapijsonschematools.codegen.model.CodegenDiscriminator;
3132
import org.openapijsonschematools.codegen.model.CodegenPatternInfo;
@@ -226,6 +227,9 @@ public PythonClientCodegen() {
226227
ParameterFeature.Schema,
227228
ParameterFeature.Content
228229
)
230+
.includeOperationFeatures(
231+
OperationFeature.Responses_RangedResponseCodes
232+
)
229233
.excludeParameterFeatures(
230234
ParameterFeature.In_Cookie
231235
)
@@ -1747,13 +1751,15 @@ public String toApiDocFilename(String name) {
17471751

17481752
@Override
17491753
public String toResponseModuleName(String componentName, String jsonPath) {
1750-
String suffix = toModuleFilename(componentName, null);
1754+
if (!jsonPath.startsWith("#/components/responses/")) {
1755+
return "response_" + componentName.toLowerCase(Locale.ROOT);
1756+
}
1757+
String suffix = toModuleFilename(componentName, jsonPath);
17511758
String spacer = "";
17521759
if (!suffix.startsWith("_")) {
17531760
spacer = "_";
17541761
}
17551762
return "response" + spacer + suffix;
1756-
17571763
}
17581764

17591765
@Override
@@ -1911,14 +1917,11 @@ public String getCamelCaseParameter(String name) {
19111917
}
19121918

19131919
public String getCamelCaseResponse(String name) {
1914-
try {
1915-
Integer.parseInt(name);
1916-
// for parameters in path, or an endpoint
1920+
if (name.matches("^\\d[X\\d]{2}$")) {
1921+
// 200 or 2XX
19171922
return "ResponseFor" + name;
1918-
} catch (NumberFormatException nfe) {
1919-
// for header parameters in responses
1920-
return toModelName(name, null);
19211923
}
1924+
return toModelName(name, null);
19221925
}
19231926

19241927
@Override

modules/openapi-json-schema-generator/src/main/resources/python/components/responses/response.hbs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,21 @@ class _ApiResponse(api_client.ApiResponse):
6969
body: schemas.Unset = schemas.unset
7070
{{else}}
7171
{{#if hasContentSchema}}
72+
{{#gt content.size 1}}
7273
body: typing.Union[
73-
{{#each content}}
74-
{{#if this.schema}}
75-
{{#with this.schema}}
74+
{{#each content}}
75+
{{#if this.schema}}
76+
{{#with this.schema}}
7677
{{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}.{{jsonPathPiece.camelCase}},
77-
{{/with}}
78-
{{else}}
78+
{{/with}}
79+
{{else}}
7980
schemas.Unset,
80-
{{/if}}
81-
{{/each}}
81+
{{/if}}
82+
{{/each}}
8283
]
84+
{{else}}
85+
body: {{#each content}}{{#if this.schema}}{{#with this.schema}}{{../@key.snakeCase}}_{{jsonPathPiece.snakeCase}}.{{jsonPathPiece.camelCase}}{{/with}}{{else}}schemas.Unset{{/if}}{{/each}}
86+
{{/gt}}
8387
{{else}}
8488
body: schemas.Unset = schemas.unset
8589
{{/if}}

modules/openapi-json-schema-generator/src/main/resources/python/paths/path/verb/_helper_operation_test_response_content.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#if content}}
22
{{#each content}}
33
{{#if schema}}
4-
response_body_schema = {{httpMethod.original}}.response_{{../@key}}.{{responseClassName}}.content["{{{@key.original}}}"].schema
4+
response_body_schema = {{httpMethod.original}}.{{responseModuleName}}.{{responseClassName}}.content["{{{@key.original}}}"].schema
55
{{/if}}
66
{{#if this.testCases}}
77
{{#each testCases}}

0 commit comments

Comments
 (0)