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

Inline endpoint descriptions #4145

Merged
merged 1 commit into from Jul 5, 2023
Merged

Inline endpoint descriptions #4145

merged 1 commit into from Jul 5, 2023

Conversation

Tymek
Copy link
Member

@Tymek Tymek commented Jul 5, 2023

Update OpenApi docs

@vercel
Copy link

vercel bot commented Jul 5, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Jul 5, 2023 8:01am
unleash-monorepo-frontend ⬜️ Ignored (Inspect) Jul 5, 2023 8:01am

Copy link
Contributor

@kwasniew kwasniew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our strategy on inline vs external file?
As we're making changes we can improve the descriptions as we added export by tag and also we need to list 401 codes.

@@ -74,7 +73,9 @@ class ExportImportController extends Controller {
200: createResponseSchema('exportResultSchema'),
...getStandardResponses(404),
},
...endpointDescriptions.admin.export,
description:
"Exports all features listed in the `features` property from the environment specified in the request body. If set to `true`, the `downloadFile` property will let you download a file with the exported data. Otherwise, the export data is returned directly as JSON. Refer to the documentation for more information about [Unleash's export functionality](https://docs.getunleash.io/reference/deploy/environment-import-export#export).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also export by tags, not just by features

@@ -74,7 +73,9 @@ class ExportImportController extends Controller {
200: createResponseSchema('exportResultSchema'),
...getStandardResponses(404),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't provide a key you may probably get 401 - I'd test it in the openapi UI

@thomasheartman
Copy link
Contributor

On inlining vs internal file descriptions: when we first started this, it was suggested that we store them in an external file to keep the code more compact. However, as it grew, we kind of forgot about it and now most of the descriptions live next to the code. Personally I think I prefer this for these reasons:

  • it lives closer to the code, so it's easier to understand what it's describing and easier to find. Saves you jumping to a different file and then finding the right key in that file.
  • it's easier for developers. Less thinking about finding the right file, placing the descriptions under the right key name etc. Just less overhead.
  • almost all our descriptions are inlined by now, so changing it would be a lot of work.

But I'd love to hear other views or suggestions too.

Copy link
Contributor

@thomasheartman thomasheartman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good change and it clears up some of our inconsistencies; good work! 🏆 And while it's not related to the changes you made, I think @kwasniew is right when it comes to the standard responses. It might be worth doing in a separate PR, though 💁🏼 (And yeah, it just means that we missed this in a previous PR)

@Tymek Tymek merged commit de8e9a0 into main Jul 5, 2023
12 checks passed
@Tymek Tymek deleted the fix/openapi-feat-1 branch July 5, 2023 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants