-
Notifications
You must be signed in to change notification settings - Fork 31
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
[DX-123] seprated db and api schemas #1701
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I will take a look on why test are failing as well :) |
you can edit the title of your PR to start with |
Oh, that is cool! thanks @hjpotter92 |
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.
LGTM!
Made comments about components/APIs that should not be in the public API reference (api-schema.yaml
). Looks like there are a lot of comments but it's just flagging of some components that should be removed from the API reference (either moved to the internal schema or deleted completely)
table: webhook | ||
properties: | ||
id: | ||
readOnly: true |
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.
readOnly
is an OpenAPI field which changes the generated documentation (doesn't include the field in the request payloads, only responses). https://swagger.io/docs/specification/data-models/data-types/
Is this breaking the readme.io generation somehow? If that's the case, this is probably something to bring up with them as they are not following the OpenAPI spec.
sourceInfo: | ||
properties: | ||
width: | ||
minValue: 1 |
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.
Interesting, I though this was OpenAPI
as well but their field is actually minimum
and maximum
. Maybe this never worked lol
recordingStatus: | ||
readonly: true | ||
recordingUrl: | ||
readonly: true | ||
mp4Url: | ||
readonly: true |
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.
typo
recordingStatus: | |
readonly: true | |
recordingUrl: | |
readonly: true | |
mp4Url: | |
readonly: true | |
recordingStatus: | |
readOnly: true | |
recordingUrl: | |
readOnly: true | |
mp4Url: | |
readOnly: true |
(should be moved to api-schema
anyway, like all other readOnly
s)
- hevc | ||
- vp8 | ||
- vp9 | ||
cdn-data-row: |
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.
This is an internal object type that should not be in api reference. We should move it to db-schema
application/json: | ||
schema: | ||
$ref: "#/components/schemas/error" | ||
/user/token: |
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.
Same, let's remove this
application/json: | ||
schema: | ||
$ref: "#/components/schemas/error" | ||
"/user/{id}": |
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.
Same, this. oneis internal. We can change it to /user/me
though and re-document it as "retrieves own user object"
application/json: | ||
schema: | ||
$ref: "#/components/schemas/error" | ||
/api-token: |
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.
Same, let's remove this. Users can only use our API with an API key, and API keys are not allowed to manage other API keys for security purposes.
application/json: | ||
schema: | ||
$ref: "#/components/schemas/error" | ||
"/region/{region}": |
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.
Same, let's remove this
application/json: | ||
schema: | ||
$ref: "#/components/schemas/error" | ||
/room: |
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.
Nice! Good to know you already rebased 🙏
Hmm, it seems like the build is also failing. Is the merged schema coming out with the exact types as the original schema? Maybe one flow that you can follow is:
|
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.
a couple documentation fixes
type: array | ||
items: | ||
$ref: "#/components/schemas/ffmpeg-profile" | ||
error: |
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.
Ohhh interesting! We should use this schema for the error responses in the API declarations below. Will save a lot of repetitive declarations.
properties: | ||
$ref: "#/components/schemas/signing-key/properties" | ||
privateKey: | ||
type: string |
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.
So this is a little hack we've used in our schema: a $ref
key that is not the only entry in the object, and then we add more keys to it. Make sure this works with readme.io!
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
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.
Amazing! Only some smaller comments now. The only one that might involve some work is the readOnly
, which might be easier to handle with a script instead of manually 🥴
Name of template to send to the users regarding the suspension. | ||
enum: | ||
- copyright | ||
webhook: |
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 think this one was forgotten here with the full spec and not only the fields diff. This can be mostly on the public API reference on ly, we only need the internal fields here (e.g. table
and the event
property).
Nevermind, realized it was including only the internal fields already (only got the readonly issue)
Friendly reminder that the readOnly
ones should go back to API reference (not sure if you intended to include that in this update, just making sure). Confirmed that readme.io supposedly supports those: https://docs.readme.com/main/discuss/6137da73509c3500180719ed
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.
Thanks! Just pushed the changes for readOnly fields going back to api-schema
type: object | ||
description: User-defined webhook context | ||
additionalProperties: true | ||
paths: |
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.
Not looking from here down as you mentioned you're updating this section later
(need to fix tests/build) Edit: did it for you 🎁 |
9aa015e
to
3d34b1b
Compare
Looks great! Good to merge @suhailkakar? |
Almost!, just pushing a final change :) |
great. feel free to merge afterwards |
I believe it is now completed, @victorges can you please confirm? |
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.
Yes!
@victorges heads up not sure if you're aware but looks like checks are failing after merging. |
Yeah that was fixed later on #1720. I think this branch wasn't rebased |
What does this pull request do? Explain your changes. (required)
Separated database and API schemas. Instead of one schema, we now have two schemas, the
api-schema.yaml
is the schema for API references, anddb-schema.yaml
is similar to API schema except it has keys that open API doesn't validate but it is needed for db such asreadOnly
,table
.Specific updates (required)
Does this pull request close any open issues?
Linear - DX 123
Checklist