Skip to content

[FR] Update to OpenAPI from CoreAPI - #4178

Merged
SchrodingersGat merged 24 commits into
inventree:masterfrom
matmair:matmair/issue3226
Apr 18, 2023
Merged

SchrodingersGat merged 24 commits into
inventree:masterfrom
matmair:matmair/issue3226

Conversation

@matmair

@matmair matmair commented Jan 8, 2023 •

Copy link
Copy Markdown
Member

This PR:

  • Adds an endpoint to get an OpenAPI schema of the API
  • Switches to use modern ReDoc
  • Adds a task to export the current schema

Fixes #3226

@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

@SchrodingersGat would you rather keep shipping self-contained API docs or hyperlink to the needed resources from a CDN?

@SchrodingersGat

Copy link
Copy Markdown
Member

Can we package them as part of docs.inventree.org? That would be my preference, keep all the documentation together.

@wolflu05

wolflu05 commented Jan 9, 2023

Copy link
Copy Markdown
Member

But how does this work with CORS and own instances (I guess @matmair is speaking about something like swagger docs). I like this idea, but think that this should also be distributed on each inventree instance using only self-contained resources and not some CDN.

@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

@SchrodingersGat we can too, I was more thinking of the self-packaged API docs we ship today.
We could make serving them optional.

@matmair
matmair marked this pull request as ready for review January 9, 2023 17:36
@matmair matmair self-assigned this Jan 9, 2023
@matmair matmair added api Relates to the API dependency Relates to a project dependency labels Jan 9, 2023
@matmair matmair added this to the 0.10.0 milestone Jan 9, 2023
@matmair
matmair marked this pull request as draft January 9, 2023 17:36
@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

@wolflu05 this version already includes local assets

@wolflu05

wolflu05 commented Jan 9, 2023

Copy link
Copy Markdown
Member

If I get this correct, your action will keep committing for each push that contains a diff in the api schema. And if the changes are removed from the pr the comment is still there?

@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

@wolflu05 I removed that part - we want to release more often and figuring this out will probably take good time.
I have got to get all my API changes in this release so we can ship the React prototype with the next.

@wolflu05

wolflu05 commented Jan 9, 2023

Copy link
Copy Markdown
Member

@matmair Ok. Sounds like a good plan. You want to ship the react ui with v0.10.0 parallel to the current ui in experimental mode to get some feedback?

@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

No, I want to prove out the APIs first and enable testing with the beta frontend while I find a solution for plugin templates. Still working out problems with shipping the compiled data in an efficient way without node, yarn etc.

@wolflu05

wolflu05 commented Jan 9, 2023

Copy link
Copy Markdown
Member

shipping the compiled data in an efficient way without node, yarn etc.

You mean for non-docker installs? For docker it would be easy to use multi stage builds for that.

@matmair

matmair commented Jan 9, 2023

Copy link
Copy Markdown
Member Author

@wolflu05 mainly, we have to get it running for deb packages and bare metal

@matmair

matmair commented Jan 26, 2023

Copy link
Copy Markdown
Member Author

@SchrodingersGat what is your opinion on this PR? Should this be in 0.10.0 or pushed back?

@SchrodingersGat

Copy link
Copy Markdown
Member

I think let's push it back to next release - I'd like to get 0.10.0 out sooner rather than later, as there are lot of important changes. This one is not as vital

@SchrodingersGat SchrodingersGat modified the milestones: 0.10.0, 0.11.0 Jan 27, 2023
@matmair matmair mentioned this pull request Apr 5, 2023
2 tasks done
@matmair

matmair commented Apr 8, 2023 •

Copy link
Copy Markdown
Member Author

@SchrodingersGat this would be ready for a review now. This changes the API docs (2 versions are included. Redoc on /api-doc and Rapidoc on /api-doc2).

We should probably look into the api docstrings, they are varying in structure a lot.

@SchrodingersGat

Copy link
Copy Markdown
Member

@matmair looks reasonable, although do we need two different version?

Comment thread InvenTree/InvenTree/settings.py Resolved
@SchrodingersGat SchrodingersGat modified the milestones: 0.11.0, 0.12.0 Apr 16, 2023
@matmair

matmair commented Apr 17, 2023

Copy link
Copy Markdown
Member Author

@SchrodingersGat redoc is pretty similar to the current docs, rapidoc is quite different.

redoc
grafik
rapidoc
grafik
grafik

@SchrodingersGat

Copy link
Copy Markdown
Member

I quite like the redoc one, can we just use that?

@matmair

matmair commented Apr 18, 2023

Copy link
Copy Markdown
Member Author

Yes, I will adjust the PR

@SchrodingersGat SchrodingersGat added the enhancement This is an suggested enhancement or new feature label Apr 18, 2023
@SchrodingersGat

Copy link
Copy Markdown
Member

Excellent work as always, thanks for implementing this @matmair

@SchrodingersGat
SchrodingersGat merged commit 9d5522c into inventree:master Apr 18, 2023
@matmair
matmair deleted the matmair/issue3226 branch April 18, 2023 15:38
@matmair

matmair commented Apr 18, 2023

Copy link
Copy Markdown
Member Author

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

Labels

api Relates to the API dependency Relates to a project dependency enhancement This is an suggested enhancement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] Update to OpenAPI from CoreAPI

4 participants