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

refactor: improve api schema #2109

Merged
merged 30 commits into from
Apr 23, 2024
Merged

refactor: improve api schema #2109

merged 30 commits into from
Apr 23, 2024

Conversation

suhailkakar
Copy link
Member

What does this pull request do? Explain your changes. (required)

  • fixes many issues and improves the api schema file

Specific updates (required)

  • format yaml file
  • add operationId to all endpoints
  • marked rooms api as deprected
  • categories endpoints by tags
    • stream
    • asset
    • webhook
    • multistream
    • session
    • room
    • transcode
    • metrics
    • playback
    • access control
  • moved unused components to db-schema
  • add examples to many components
  • override name for sdk generation (so response method will always be res.data instead of res.classes or res.object
  • override operation name for sdk generation (to make sdk methods a lot nices like livepeer.asset.create or livepeer.stream.get

How did you test each of these updates (required)

Does this pull request close any open issues?

Screenshots (optional)

Checklist

  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@suhailkakar suhailkakar requested a review from a team as a code owner March 22, 2024 08:45
Copy link

vercel bot commented Mar 22, 2024

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

Name Status Preview Comments Updated (UTC)
livepeer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 23, 2024 0:58am

@suhailkakar suhailkakar marked this pull request as draft March 22, 2024 08:54
Copy link
Member

@0xcadams 0xcadams left a comment

Choose a reason for hiding this comment

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

LGTM, some tiny nits

packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Show resolved Hide resolved
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

Awesome!!

packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Show resolved Hide resolved
packages/api/src/schema/db-schema.yaml Outdated Show resolved Hide resolved
suhailkakar and others added 3 commits April 9, 2024 21:37
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Victor Elias <victor@livepeer.org>
@adamsoffer adamsoffer marked this pull request as ready for review April 9, 2024 20:05
Copy link
Member

@victorges victorges left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -72,7 +72,17 @@ const data = _.merge({}, apiData, dbData);
const indexPath = path.resolve(validatorDir, "index.js");
write(indexPath, indexStr);

const typeStr = types.join("\n");
const typeDefinition = `export type InputCreatorId =
Copy link
Member

Choose a reason for hiding this comment

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

So weird that this was necessary. Did you get to understand why it was being generated twice?

input-creator-id:
oneOf:
- $ref: "#/components/schemas/creator-id"
Copy link
Member

Choose a reason for hiding this comment

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

Can we keep the inline $ref given the fix on compile-schemas.js? Or is this part of the fix?

packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
packages/api/src/schema/api-schema.yaml Outdated Show resolved Hide resolved
Comment on lines +2679 to +2685
objectStoreId:
type: string
description: Object store ID where the asset is stored
writeOnly: true
example: 09F8B46C-61A0-4254-9875-F71F4C605BC7
catalystPipelineStrategy:
$ref: "#/components/schemas/task/properties/params/properties/upload/properties/catalystPipelineStrategy"
Copy link
Member

Choose a reason for hiding this comment

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

I think these 2 fields should be moved to db-schema since they're somewhat internal

@0xcadams 0xcadams merged commit 47dbc3c into master Apr 23, 2024
13 checks passed
@0xcadams 0xcadams deleted the schema-fix branch April 23, 2024 15:49
suhailkakar added a commit that referenced this pull request Apr 24, 2024
* Stick to the pull host while triggering the catalyst pull start (#2138)

* Revert "Stick to the pull host while triggering the catalyst pull start (#2138)" (#2141)

This reverts commit 29ad25a.

* Stick to the pull host while triggering the catalyst pull start (#2142)

* api: ingest: direct base & playback (#2139)

* api: ingest: direct base & playback

* fix

* fix

* implement for a specific hardcoded id for tests

* fix

* fix

* api: Handle active cleanup from pull lock API (#2144)

* refactor: improve api schema (#2109)

* format yaml

* add operationId to all endpoints

* marked rooms api as deprecated

* add tags to each endpoints

* moved unused components to db-schema

* add examples

* override name for sdk generation

* override operation name for sdk generatino

* run prettier & fix typo

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update packages/api/src/schema/api-schema.yaml

Co-authored-by: Victor Elias <victor@livepeer.org>

* Update api-schema.yaml

* fix: build error

* revert: add new-asset-from-url-payload to api-schema.yaml

* Update api-schema.yaml

* fix build issue

* hardcoded inputcreator filter

* fix: create stream and loosening schema (#2134)

* Update compile-schemas.js

* fix: tsconfig

* fix: revert additionalproperties

* fix: remove InputCreatorId unknown

* fix: api schema

* fix: api schema

* fix: revert changes to additional properties

* fix: fixes from review

* fix: lint

---------

Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Chase Adams <c@cadams.io>

* api: Query isHealthy field as a string to handle JSOnull (#2143)

* api: Query isHealthy field as a string to handle JSOnull

* api: Add check on boolean fields filter value

* api: moved objectStoreId and catalystPipelineStrategy to db schema (#2146)

* api: moved params to db schema

* Update db-schema.yaml

* remove url

* api: fix direct playback api (#2147)

* fix june trigger (#2145)

* fix sending track multiple times

* add missing imports

* replace track with page method

---------

Co-authored-by: Rafał Leszko <rafal@livepeer.org>
Co-authored-by: gioelecerati <50955448+gioelecerati@users.noreply.github.com>
Co-authored-by: Victor Elias <victor@livepeer.org>
Co-authored-by: Chase Adams <c@cadams.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants