Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Open API document generated by Hakunapi and used by demo service #69

Closed
teezip opened this issue Oct 10, 2023 · 4 comments
Closed
Milestone

Comments

@teezip
Copy link
Collaborator

teezip commented Oct 10, 2023

Currently at least Open API document represented as JSON provided by https://beta-paikkatieto.maanmittauslaitos.fi/inspire-addresses/features/v1/api.json fails when analyzing it in Swagger editor (or other tools).

Gives multiple errors like:
Structural error at paths./.get.responses.200.content.text/html
should NOT have additional properties
additionalProperty: exampleSetFlag
Jump to line 33

When accessing Open API document as HTML content in browser (https://beta-paikkatieto.maanmittauslaitos.fi/inspire-addresses/features/v1/api) HTML document is shown without errors.

The issue is related to the exampleSetFlag property (that informs "whether an example is set to null intentionally") in OpenAPI class of Hakunapi - this property should not be serialized to Open API document output.

@jampukka jampukka added this to the 1.2.0 milestone Oct 10, 2023
@jampukka
Copy link
Collaborator

This should be fixed by #71 (at least according to my manual and integration tests)

@teezip
Copy link
Collaborator Author

teezip commented Oct 11, 2023

Thanks. Tested by setting up demo service on a local machine from features.war build from latest code in main (that should have #71 merged). The demo service on a local machine give Open API document that is OK according to Swagger editor, but still one error: Structural error at info.contact.email because by default email address is empty string '' in demo conf.

This is not a bug in Hakunapi, but in configuration of demo application.

When removing api.contact.email from addresses.properties it results in Open API document with info.contact.email to be 'N/A'. Swagger editor complains about this too.

Maybe it would be better to leave an optional info.contact.email element out of Open API output if not set in conf file?

Anyway when setting api.contact.email in conf as a valid formatted email address then demo service returns an Open API document that can be viewed without complaints in Swagger editor too.

@teezip
Copy link
Collaborator Author

teezip commented Oct 11, 2023

Maybe instructions in https://github.com/nlsfi/hakunapi/tree/main/examples/finnish_addresses in section "Preparing for production" could ask installers of demo service to set their contact information (including that info.contact.email) to get Open API document that Swagger Editor swallows too...

@jampukka
Copy link
Collaborator

Allowed null/missing contact information to omit the contact element from OpenAPI description altogether in #75. Changed finnish_addresses example to reflect that and added a note about setting proper contact values in "Preparing for production" section

@teezip teezip closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants