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

API documentation issues #334

Open
marcus-bcl opened this issue Oct 3, 2023 · 2 comments
Open

API documentation issues #334

marcus-bcl opened this issue Oct 3, 2023 · 2 comments

Comments

@marcus-bcl
Copy link

What should change

After following the guide to generate API documentation from an OpenAPI spec, we've found that Array/List responses are rendered incorrectly - they appear as empty objects.

For example, see: https://ministryofjustice.github.io/hmpps-probation-integration-services/tech-docs/projects/create-and-vary-a-licence-and-delius/api-reference.html#probation-case-crn-addresses
image

The response should appear as a a list of objects as they do in Swagger, for example: https://create-and-vary-a-licence-and-delius-dev.hmpps.service.justice.gov.uk/swagger-ui/index.html#/probation-case-resource/findAddresses
image

@anahickmann
Copy link

anahickmann commented Mar 27, 2024

I've had a similar problem with list of strings getting displayed as a list with one empty object.

This is how the response is getting displayed (i.e. an array with one empty object):
Screenshot 2024-03-27 at 10 27 38

And this is how it should get displayed (i.e. an array with one string):
Screenshot 2024-03-27 at 10 27 55

@ntsim
Copy link

ntsim commented Oct 28, 2024

On our API docs, we found the generated docs inadequate and essentially re-implemented the entire thing to suit our use-case.

There's fairly substantial parts of the OpenAPI spec that aren't covered by the gem's built-in implementation such as polymorphic types (which we've used extensively in our API).

For anyone interested, we created a new module which we load in through config.rb. We then have a bunch of helpers that we use throughout the various templates:

This is by no means a complete implementation so your mileage may vary. It should still be a useful starting point for anyone wanting to improve their generated docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants