@@ -25,12 +25,12 @@ def build_openAPI_specification(api_data):
2525
2626 for entity in tax_benefit_system .entities :
2727 name = entity .key .title ()
28- spec ['definitions ' ][name ] = get_entity_json_schema (entity , tax_benefit_system )
28+ spec ['components' ][ 'schemas ' ][name ] = get_entity_json_schema (entity , tax_benefit_system )
2929
3030 situation_schema = get_situation_json_schema (tax_benefit_system )
31- dpath .util .new (spec , 'definitions /SituationInput' , situation_schema )
32- dpath .util .new (spec , 'definitions /SituationOutput' , situation_schema .copy ())
33- dpath .util .new (spec , 'definitions /Trace/properties/entitiesDescription/properties' , {
31+ dpath .util .new (spec , 'components/schemas /SituationInput' , situation_schema )
32+ dpath .util .new (spec , 'components/schemas /SituationOutput' , situation_schema .copy ())
33+ dpath .util .new (spec , 'components/schemas /Trace/properties/entitiesDescription/properties' , {
3434 entity .plural : {'type' : 'array' , 'items' : {"type" : "string" }}
3535 for entity in tax_benefit_system .entities
3636 })
@@ -43,24 +43,24 @@ def build_openAPI_specification(api_data):
4343 parameter_example = api_data ['parameters' ][parameter_path ]
4444 else :
4545 parameter_example = next (iter (api_data ['parameters' ].values ()))
46- dpath .util .new (spec , 'definitions /Parameter/example' , parameter_example )
46+ dpath .util .new (spec , 'components/schemas /Parameter/example' , parameter_example )
4747
4848 if tax_benefit_system .open_api_config .get ('variable_example' ):
4949 variable_example = api_data ['variables' ][tax_benefit_system .open_api_config ['variable_example' ]]
5050 else :
5151 variable_example = next (iter (api_data ['variables' ].values ()))
52- dpath .util .new (spec , 'definitions /Variable/example' , variable_example )
52+ dpath .util .new (spec , 'components/schemas /Variable/example' , variable_example )
5353
5454 if tax_benefit_system .open_api_config .get ('simulation_example' ):
5555 simulation_example = tax_benefit_system .open_api_config ['simulation_example' ]
56- dpath .util .new (spec , 'definitions /SituationInput/example' , simulation_example )
57- dpath .util .new (spec , 'definitions /SituationOutput/example' , handlers .calculate (tax_benefit_system , deepcopy (simulation_example ))) # calculate has side-effects
58- dpath .util .new (spec , 'definitions /Trace/example' , handlers .trace (tax_benefit_system , simulation_example ))
56+ dpath .util .new (spec , 'components/schemas /SituationInput/example' , simulation_example )
57+ dpath .util .new (spec , 'components/schemas /SituationOutput/example' , handlers .calculate (tax_benefit_system , deepcopy (simulation_example ))) # calculate has side-effects
58+ dpath .util .new (spec , 'components/schemas /Trace/example' , handlers .trace (tax_benefit_system , simulation_example ))
5959 else :
6060 message = "No simulation example has been defined for this tax and benefit system. If you are the maintainer of {}, you can define an example by following this documentation: https://openfisca.org/doc/openfisca-web-api/config-openapi.html" .format (country_package_name )
61- dpath .util .new (spec , 'definitions /SituationInput/example' , message )
62- dpath .util .new (spec , 'definitions /SituationOutput/example' , message )
63- dpath .util .new (spec , 'definitions /Trace/example' , message )
61+ dpath .util .new (spec , 'components/schemas /SituationInput/example' , message )
62+ dpath .util .new (spec , 'components/schemas /SituationOutput/example' , message )
63+ dpath .util .new (spec , 'components/schemas /Trace/example' , message )
6464 return spec
6565
6666
0 commit comments