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

apidom-reference: internal vs external resolution #3451

Closed
6 tasks done
char0n opened this issue Nov 24, 2023 · 10 comments
Closed
6 tasks done

apidom-reference: internal vs external resolution #3451

char0n opened this issue Nov 24, 2023 · 10 comments
Assignees
Labels

Comments

@char0n
Copy link
Member

char0n commented Nov 24, 2023

Our dereference strategies can be configured to skip resolving external references.

Let's think about if it makes sense to configure allowing/disallowing resolving internal references as well. This will get very complicated with OpenAPI 3.1.0 so needs to be researched first.

Next thing is properly determining what is external and what is internal. Our current mechanism of deciding is IMHO insufficient in OpenAPI 3.1.0 dereference, because of use of JSON Schema 2020-12 $id keyword. If the URI defined in $id keyword is not found within the root definition, we fallback to fetching the URL.

TODO:

  • apidom
  • asyncapi-2
  • openapi-2
  • openapi-3-0
  • openapi-3-1
  • needs to be refactored in swagger-client as well
@char0n
Copy link
Member Author

char0n commented Nov 24, 2023

For AsyncAPI 2.x, OpenAPI 2.0, OpenAPI 3.0.x - determining what is internal and external reference is quite straightforward. It already works properly (needs to be double-checked just to be sure).

For OpenAPI 3.1.0 - it's quite complicated as already mentioned above:

Next thing is properly determining what is external and what is internal. Our current mechanism of deciding is IMHO insufficient in OpenAPI 3.1.0 dereference, because of use of JSON Schema 2020-12 $id keyword. If the URI defined in $id keyword is not found within the root definition, we fallback to fetching the URL.

Ideally we want a solution is that common for all dereference strategies.

char0n added a commit that referenced this issue Nov 24, 2023
….0 (#3454)

This change will handle cases where the referenced data is served
from the external URL, but the definition is served on the
the same external URL as well.

Refs #3451
char0n added a commit that referenced this issue Nov 24, 2023
….0.x (#3455)

This change will handle cases where the referenced data is served
from the external URL, but the definition is served on the
the same external URL as well.

Refs #3451
@char0n
Copy link
Member Author

char0n commented Nov 24, 2023

OpenAPI 3.1.0 now remains to be fixed.

char0n added a commit that referenced this issue Nov 27, 2023
This change will handle cases where the referenced data is served
from the external URL, but the definition is served on the
the same external URL as well.

Refs ##3451
@char0n
Copy link
Member Author

char0n commented Nov 28, 2023

One more bug related to other dereference strategies than OpenAPI 3.1.0 - all visitors needs to introduce toBaseURI method to determine the URL before it's fetched. Now they do fetch the URL and then stop visiting.

char0n added a commit that referenced this issue Nov 28, 2023
…3459)

This change will handle cases where the referenced data is served
from the external URL, but the definition is served on the
the same external URL as well.

Refs #3451
char0n added a commit that referenced this issue Nov 28, 2023
This change affects all dereference and resolution
strategies.

Refs #3451
char0n added a commit that referenced this issue Nov 28, 2023
This change affects all dereference and resolution
strategies.

Refs #3451
@char0n
Copy link
Member Author

char0n commented Nov 28, 2023

What remains now is to add support for options.resolve.internal option into all dereference strategies. This will allow to base resolution strategies on dereference ones and by default set options.resolve.internal=false for all resolution strategies without ability to change it.

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

apidom resolve strategy addressed in #3902

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

OpenAPI 2.0 resolve strategy addressed in #3903

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

OpenAPI 3.0 addressed in #3904

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

AsyncAPI 2.0 addressed in #3905

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

OpenAPI 3.1.0 addressed in #3906

@char0n
Copy link
Member Author

char0n commented Mar 7, 2024

swaggre-client integration addressed in swagger-api/swagger-js#3403

@char0n char0n closed this as completed Mar 7, 2024
char0n added a commit to swagger-api/swagger-js that referenced this issue Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant