-
Notifications
You must be signed in to change notification settings - Fork 286
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
Update openapi template #323
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 29 additions & 11 deletions
40
apps/opik-backend/src/main/resources/openapi_template.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
openapi: 3.1.0 | ||
info : | ||
description : "APIs" | ||
description : | | ||
The Opik REST API is currently in beta and subject to change. If you have any questions or feedback about the APIs, please reach out on GitHub: https://github.com/comet-ml/opik. | ||
|
||
All of the methods listed in this documentation are used by either the SDK or the UI to interact with the Opik server. As a result, | ||
the methods have been optimized for these use-cases in mind. If you are looking for a method that is not listed above, please create | ||
and issue on GitHub or raise a PR! | ||
|
||
Opik includes two main deployment options that results in slightly different API usage: | ||
|
||
- **Self-hosted Opik instance:** You will simply need to specify the URL as `http://localhost:5173/api/<endpoint_path>` or similar. This is the default option for the docs. | ||
- **Opik Cloud:** You will need to specify the Opik API Key and Opik Workspace in the header. The format of the header should be: | ||
|
||
``` | ||
{ | ||
"Comet-Workspace": "your-workspace-name", | ||
"authorization": "your-api-key" | ||
} | ||
``` | ||
|
||
Do take note here that the authorization header value does not include the `Bearer ` prefix. To switch to using the Opik Cloud in the documentation, you can | ||
click on the edit button displayed when hovering over the `Base URL` displayed on the right hand side of the docs. | ||
|
||
version : "1.0.0" | ||
title : "APIs" | ||
title : "Opik REST API" | ||
contact : | ||
name : "Support" | ||
email : "support@comet.com" | ||
name : "Github Repository" | ||
url : "https://github.com/comet-ml/opik" | ||
license : | ||
name : "Apache 2.0" | ||
url : "http://www.apache.org/licenses/LICENSE-2.0.html" | ||
|
||
servers : | ||
- url : "{basePath}/{apiVersion}" | ||
description : "Local server" | ||
variables: | ||
basePath: | ||
default: "http://localhost:8080" | ||
apiVersion: | ||
default: "v1" | ||
- url: http://localhost:5173/api | ||
description: Local server | ||
- url: https://www.comet.com/opik/api | ||
description: Opik Cloud |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
basePath
variable is referenced from all swagger annotations.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrescrz Is this inline documentation in Java ? Because it is being rendered correctly in the docs: https://www.comet.com/docs/opik/reference/rest_api/find-experiments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's actually the source of truth. The whole OpenAPI spec is generated from the swagger annotations in the Java code.
This affects the generated
openapi.yaml
file which is served in localhost:3003.I just checked and the missing variables are just ignored and it works well there. But you should clean up the old references.
After that, you just need to double check how the Fern generation is affected and if all is good in the auto-generated code of the SDK.
After those two are ok, you should be good to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have checked that the Fern SDK code is generated correctly (no diffs in the output code and trace logged correctly), I will go ahead and merge the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that you tested it and no issues, so fine to moved ahead with this. But I don't think it's right to leave the annotations in the Java code pointing to an deleted variable (basePath). I recommend cleaning those up in a follow up PR. It's a trivial change, just find a replace everywhere plus checking that all good after.