-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: fix OpenAPI pk/fk note not being overridable #1701
Conversation
Uh. This immediately breaks my client lib |
@wolfgangwalther Ah, I didn't think anyone was relying on those notes. Would adding an Also, do you use the foreign key (I see it's used here: https://github.com/technowledgy/vue-postgrest/blob/4dd955799dddcdffafc022264eb1242bddb2e2eb/src/Route.js#L22) |
I haven't looked deeper into that, but I guess it would. I just need to know which columns identify records on a route uniquely, so that I can use those for all my
Nope, I can't imagine a use-case. I would hope to have "embedding opportunities" available in the future, that would help. Better to know about those before, than just after a 300 response... But I'm not going to derive those from |
Since vendor extensions are not supported GetShopTV/swagger2#4 (and there's no workaround but to patch upstream). I'm thinking about adding the pk/fk notes on the curl -s localhost:3000 | jq .definitions.articles.properties
{
"id": {
"format": "integer",
"additionalProperties": {
"description": "Note:\nThis is a Primary Key.<pk/>\n"
},
"type": "integer",
"description": "An article primary key"
},
"body": {
"format": "text",
"type": "string"
},
"owner": {
"format": "name",
"type": "string"
}
} @wolfgangwalther Would that work for you? |
I think it'd just be a matter of changing: //from
fieldDef.description?.includes('<pk/>'))
//to
fieldDef.additionalProperties.description?.includes('<pk/>')) So I'll go ahead with the change :) |
Resolves PostgREST#1700 BREAKING CHANGE: OpenAPI annotations for pk/fk are now on the `properties.additionalProperties.description` field.
b086b79
to
534bf6b
Compare
I couldn't find any docs on
|
Not possible to add a Also, the description format doesn't change in this PR. That would help other users that also relied on that behavior, easier migration. Besides that, I don't think it's worth to put much work on this since #1698 is the way forward. |
But to be honest, I don't think My understanding is that What is the urgency in removing this from the description? Does the "Note: ..." break any usecase? Why can't it wait until we solve the openapi stuff properly in SQL and we don't have to add some strange hacks here? |
Ah yes, those Types match my expectation and just confirm that adding the note in the description of an otherwise non-existent sub-schema is really... not valid openapi at all. |
To summarize: It feels like this PR is just replacing one hack with another, worse, hack. It was never the best idea to add |
I only need |
Yeah, my original intention was to remove the hack. But since that breaks I'll just close this one. Let's solve this later as part of #1698. |
Ah, yes. It breaks OpenAPI UIs, as the notes don't go away despite adding a comment for the column. The This happens for supabase.io, which shows our OpenAPI comments. Not sure how users of Swagger UI are cleaning the comments or if it was ever an issue there. But in Supabase's case, the comments are now cleaned with js on frontend. |
Adding on here, would it be possible to override this behavior with something like: Thanks! |
Resolves #1700.
I've just allowed overriding the notes with the db comment.
I looked into adding
x-primary-key
orx-foreign-key
fields to not lose the metadata, but seems this is not easy with our current swagger lib: GetShopTV/swagger2#113 (comment).Still I think this is a better behavior, I'll leave adding the extensions for our future OpenAPI-in-SQL #1698.