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

Problem: Pulp's OpenAPI schema has verbose Operation Ids #178

Merged
merged 1 commit into from
Jun 25, 2019

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented Jun 19, 2019

Solution: add ability to request shorter operation ids in the schema

This patch adds ability to specify 'bindings' query parameter when requesting the OpenAPI
schema. When specified, a short OperationId is used for each operation.

This patch also changes how the OpenAPI schema operations are grouped together. Each resource
now has its own tag associated with it. This results in better REST API docs and better
experience for users of bindings.

The tag for a resource is determined from it's URL. The plugin name is omitted from the tag. For
example:

URL: /pulp/api/v3/repositories/
Tag: Repositories

URL: /pulp/api/v3/repositories/uuid-of-some-sort/versions/
Tag: Repositories: Versions

URL: /pulp/api/v3/content/file/files/
Tag: Content: Files

URL: /pulp/api/v3/remotes/file/file/
Tag: Remotes: File

Required PR: pulp/pulp-openapi-generator#18

re: #4989
https://pulp.plan.io/issues/4989

dkliban added a commit to dkliban/pulp-openapi-generator that referenced this pull request Jun 19, 2019
Solution: request OpenAPI schema with 'bindings' query parameter

This patch takes advantage of a new feature in pulpcore that allows generating OpenAPI schema
with short Operation Ids.

Required PR: pulp/pulpcore#178

re: #4989
https://pulp.plan.io/issues/4989
@dkliban dkliban force-pushed the bindings-openapi-schema branch 3 times, most recently from 3e637ea to 3d0be48 Compare June 19, 2019 14:45
@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #178 into master will decrease coverage by 0.28%.
The diff coverage is 7.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #178      +/-   ##
==========================================
- Coverage   67.33%   67.05%   -0.29%     
==========================================
  Files          65       65              
  Lines        3089     3102      +13     
==========================================
  Hits         2080     2080              
- Misses       1009     1022      +13
Impacted Files Coverage Δ
pulpcore/app/viewsets/upload.py 66.66% <ø> (ø) ⬆️
pulpcore/app/openapigenerator.py 19.73% <7.14%> (-1.13%) ⬇️
pulpcore/app/viewsets/task.py 93.42% <0%> (-1.32%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5274fe3...7748ffd. Read the comment docs.

dkliban added a commit to dkliban/pulp-openapi-generator that referenced this pull request Jun 19, 2019
Solution: request OpenAPI schema with 'bindings' query parameter

This patch takes advantage of a new feature in pulpcore that allows generating OpenAPI schema
with short Operation Ids.

Required PR: pulp/pulpcore#178

re: #4989
https://pulp.plan.io/issues/4989
@dkliban dkliban force-pushed the bindings-openapi-schema branch 2 times, most recently from 2013eb0 to a04afb9 Compare June 20, 2019 11:36
dkliban added a commit to dkliban/pulp-openapi-generator that referenced this pull request Jun 20, 2019
Solution: request OpenAPI schema with 'bindings' query parameter

This patch takes advantage of a new feature in pulpcore that allows generating OpenAPI schema
with short Operation Ids.

Required PR: pulp/pulpcore#178

re: #4989
https://pulp.plan.io/issues/4989
@mdellweg
Copy link
Member

I like the resulting bindings.
And if two plugins provide a content type packages, it is still namespaced by the python client module, i guess ?!?

@dkliban
Copy link
Member Author

dkliban commented Jun 20, 2019

I like the resulting bindings.
And if two plugins provide a content type packages, it is still namespaced by the python client module, i guess ?!?

Yes, even if it is called the same thing, the object is provided by a different package.

Solution: add ability to request shorter operation ids in the schema

This patch adds ability to specify 'bindings' query parameter when requesting the OpenAPI
schema. When specified, a short OperationId is used for each operation.

This patch also changes how the OpenAPI schema operations are grouped together. Each resource
now has its own tag associated with it. This results in better REST API docs and better
experience for users of bindings.

The tag for a resource is determined from it's URL. The plugin name is omitted from the tag. For
example:

URL: /pulp/api/v3/repositories/
Tag: Repositories

URL: /pulp/api/v3/repositories/<uuid>/versions/
Tag: Repositories: Versions

URL: /pulp/api/v3/content/file/files/
Tag: Content: Files

URL: /pulp/api/v3/remotes/file/file/
Tag: Remotes: File

Required PR: pulp/pulp-openapi-generator#18

re: pulp#4989
https://pulp.plan.io/issues/4989
Copy link
Member

@bmbouter bmbouter left a comment

Choose a reason for hiding this comment

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

This all makes sense to me.

@dkliban dkliban merged commit eb66e5c into pulp:master Jun 25, 2019
@dkliban dkliban deleted the bindings-openapi-schema branch June 25, 2019 00:59
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

3 participants