OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
28.97k stars 9.07k forks source link

Support partial responses #1773

Closed raderio closed 9 months ago

raderio commented 5 years ago

Will be very useful to document that API support partial responses. This will give a strong point when comparing with GraphQL.

Like GET /api/blogposts?fields=author{name,avatar},title,detail

https://www.leliam.com/make-rest-api-to-partial-response-just-like-graphql-@bRyL6nWufIxFXIdNWRdAwN https://apigee.com/about/blog/technology/restful-api-design-can-your-api-give-developers-just-information-they-need

Can you please integrate partial response?

MikeRalphson commented 5 years ago

What kind of support in the specification do you additionally need to implement this today?

raderio commented 5 years ago

To add a special type like "JsonPath" to indicate that it can have predefined values.

MikeRalphson commented 5 years ago

No, sorry, I still can't visualise what you mean.

Can you show an example of what an OpenAPI 3 document would look like modified to include your requirements?

raderio commented 5 years ago

Something like fields editor from https://developers.google.com/apis-explorer/#p/blogger/v3/blogger.blogs.listByUser

Like explorer in graphql https://www.onegraph.com/blog/2019/01/24/How_OneGraph_onboards_users_new_to_GraphQL.html#introducing-the-onegraph-graphiql-explorer

fields

handrews commented 9 months ago

I think you are asking about returning subsets of a resource's fields? The OpenAPI Specification just describes what is possible, so you can describe this by making the fields optional. But the OAS does not implement the server (unlike GraphQL), so the actual returning of selected fields is outside of our scope.

Please let me know if I'm misunderstanding and I can re-open this.