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

openapi: document operations for admin ui feedback #4226

Merged
merged 8 commits into from
Jul 13, 2023

Conversation

thomasheartman
Copy link
Contributor

This PR updates the endpoint documentation and schemas related to Admin UI feedback.

@sonatype-lift
Copy link

sonatype-lift bot commented Jul 13, 2023

Sonatype Lift is retiring

Sonatype Lift will be retiring on Sep 12, 2023, with its analysis stopping on Aug 12, 2023. We understand that this news may come as a disappointment, and Sonatype is committed to helping you transition off it seamlessly. If you’d like to retain your data, please export your issues from the web console.
We are extremely grateful and thank you for your support over the years.

📖 Read about the impacts and timeline

@vercel
Copy link

vercel bot commented Jul 13, 2023

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

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 13, 2023 8:33am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 13, 2023 8:33am

responses: { 200: createResponseSchema('feedbackSchema') },
responses: {
200: createResponseSchema('feedbackSchema'),
...getStandardResponses(400, 401, 415),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get a 404 if the id does not exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! Let me find out!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You should! Right now you might get a 500 😳

Copy link
Contributor

Choose a reason for hiding this comment

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

I found similar situations on other update endpoints!

Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. I try to turn those 5xx into client 4xx errors whenever I test some endpoint. As as general rule of thumb if the endpoint has id or some other query/path param we may need to test for 400 vs 500 handling

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it does not. If it doesn't exist, we create that feedback id..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update: this only returns 500 if you use an admin token (and thus have no identifiable user). @kwasniew , I think we might have discussed cases like this before? I don't know if it's worth adding the handling for this in this one specific place now, but I can definitely add it to the description.

Copy link
Contributor

Choose a reason for hiding this comment

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

I remember us having this conversation but I don't remember how we solved it. @sjaanus do you remember what we did for the admin tokens that had no user id?

Copy link
Contributor

@sjaanus sjaanus Jul 13, 2023

Choose a reason for hiding this comment

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

I think we never solved it, but the consensus was that are moving away from admin tokens and endpoints that require user as foreign key, will not work for admin tokens.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, I'm going to merge it for now and we can update that later if we want to.

app = await setupAppWithCustomAuth(stores, preHook, {
experimental: {
flags: {
strictSchemaValidation: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

Looks good! Maybe we can use this opportunity to improve the NotFound returning a 500, but can also be part of a different PR

@thomasheartman
Copy link
Contributor Author

@gastonfournier The 500 wasn't because the ID was not found, but because I used an admin token. You need an identifiable user to post and put these.

@thomasheartman thomasheartman deleted the openapi/admin-ui-feedback branch July 13, 2023 11:27
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

4 participants