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

Add support for $ref URIs containing fragments in OpenAPI definitions and JSON schemas #1751

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

zecakeh
Copy link
Contributor

@zecakeh zecakeh commented Mar 13, 2024

Based on #1745.

There is a first commit to add support for fragments in $ref URIs, to solve (simple) JSON Pointers. It also adds support for Reference Objects for OpenAPI request parameters and responses.

Preview: https://pr1751--matrix-spec-previews.netlify.app

And add support for reference objects to OpenAPI properties.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh requested a review from a team as a code owner March 13, 2024 15:42
@richvdh
Copy link
Member

richvdh commented Mar 13, 2024

oh no 🤦

This is the same thing as I did in #1749 :(

@zecakeh
Copy link
Contributor Author

zecakeh commented Mar 13, 2024

I saw that 5 minutes ago, well it is kind of a completely different approach for the same purpose though

@richvdh
Copy link
Member

richvdh commented Mar 18, 2024

@zecakeh As I've written over at #1749, this approach seems sensible, but I'd like to land it independently of #1745. Could you rebase it without that?

And use a single implementation of resolve_references for all scripts.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@zecakeh zecakeh force-pushed the relations-common-params branch from 39515b1 to 7413a9e Compare March 18, 2024 15:45
@zecakeh
Copy link
Contributor Author

zecakeh commented Mar 18, 2024

Alright, I removed the commit with the OpenAPI definition change. I added a commit to also support refs with fragments in the CI scripts.

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
@@ -21,6 +21,6 @@

{{ $api_data := index .Site.Data.api .Params.spec .Params.api }}
{{ $base_url := (index $api_data.servers 0).variables.basePath.default }}
{{ $path := delimit (slice "api" $spec) "/" }}
{{ $path := delimit (slice "api" $spec $api) "/" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, in the end, should we call resolve-refs directly after this?

Copy link
Member

Choose a reason for hiding this comment

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

well, probably, yes. But we don't necessarily need to change that today.

@@ -1,7 +1,10 @@
{{/*
Copy link
Contributor Author

@zecakeh zecakeh Mar 18, 2024

Choose a reason for hiding this comment

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

Should we do like in #1749 and only allow to override properties named description and summary?

Copy link
Member

Choose a reason for hiding this comment

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

No, I don't think that's necessary. The validator will complain if anyone tries to override other properties, I think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I doesn't, afaict.

Copy link
Member

Choose a reason for hiding this comment

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

oh. bother. Well, maybe something to think about adding into our validation scripts in future.

@zecakeh zecakeh changed the title Factor out the common parameters of the /relations endpoints Add support for $ref URIs containing fragments in OpenAPI definitions and JSON schemas Mar 18, 2024
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -1,7 +1,10 @@
{{/*
Copy link
Member

Choose a reason for hiding this comment

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

No, I don't think that's necessary. The validator will complain if anyone tries to override other properties, I think?

@@ -21,6 +21,6 @@

{{ $api_data := index .Site.Data.api .Params.spec .Params.api }}
{{ $base_url := (index $api_data.servers 0).variables.basePath.default }}
{{ $path := delimit (slice "api" $spec) "/" }}
{{ $path := delimit (slice "api" $spec $api) "/" }}
Copy link
Member

Choose a reason for hiding this comment

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

well, probably, yes. But we don't necessarily need to change that today.

@richvdh richvdh merged commit 4d7e33e into matrix-org:main Mar 19, 2024
12 checks passed
@zecakeh zecakeh deleted the relations-common-params branch March 19, 2024 17:33
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.

2 participants