hapifhir / hapi-fhir

🔥 HAPI FHIR - Java API for HL7 FHIR Clients and Servers
http://hapifhir.io
Apache License 2.0
2.04k stars 1.33k forks source link

Invalid openAPI definition in hapi fhir server 6.2.0 #4137

Open kubernegit opened 2 years ago

kubernegit commented 2 years ago

Problem Some paths in the openAPI definition miss the schema for the data type, which leads to errors in the openapi-generator and in swagger.

I tried to generate a NestJS API client, based on the current openAPI definition using the openapi-generator-cli. The tool refused to generate code and printed out that the content of some GET paths are missing. Here are some examples:

[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/ExampleScenario'(get).parameters.[status].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/MedicinalProductPharmaceutical'(get).parameters.[_filter].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/Account/{id}/$diff'(get).parameters.[to].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/Organization/{id}/$validate'(get).parameters.[resource].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/VerificationResult'(get).parameters.[_id].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/StructureMap/{id}/$diff'(get).parameters.[to].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/AppointmentResponse'(get).parameters.[_id].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/EffectEvidenceSynthesis'(get).parameters.[_tag].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/ImmunizationRecommendation'(get).parameters.[_tag].content is missing
[[nestjs-generator] ./hapi-fhir-openapi.yaml]   -attribute paths.'/SearchParameter/{id}/$diff'(get).parameters.[from].content is missing

I asked for help in this stackoverflow question, and it was pointed out that some paths seem to miss the schema for the data type. This also leads to errors when pasting the definition into https://editor.swagger.io

Expected behavior The schemata are given in the GET routes which should make code generation possible.

Environment

If I am wrong and the error is on my side, I am thankful for any hint.

rammic commented 1 year ago

Seeing the same issue here. No resource schemas are included in the generated OpenAPI specs (example HealthcareService).

robrez commented 1 year ago

Encountered this issue today w/ latest version of the hapi openapi document and versions 6.0.1, 7.0.1 of the openapi-generator

I've been trying w/ other openapi defs

I think I'd previously learned (I forget where from) that @DefinitelyTyped/fhir ultimately comes from the microsoft/fhir-codegen project. I can get the codegenerator to work w/ that json file, but it's dated (in terms of OpenAPI spec version and its content)