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

Expander: when expanding with SkipSchema, the relative path is lost #182

Closed
fredbi opened this issue Jan 8, 2024 · 0 comments · Fixed by #183
Closed

Expander: when expanding with SkipSchema, the relative path is lost #182

fredbi opened this issue Jan 8, 2024 · 0 comments · Fixed by #183
Assignees

Comments

@fredbi
Copy link
Member

fredbi commented Jan 8, 2024

When running ExpandSpec with the SkipSchema option, for $ref's in parameters or responses, relative paths when exploring
multiple documents pointed by $ref is not properly maintained.

This happens when a ref-ed document in a folder refers to another doc via relative paths like "../folder".

In the attached example, the "working" spec SHOULD not work whereas the "not-working" spec SHOULD.

The "SkipSchema" option is used by the spec flattening feature exposed by go-openapi/analysis.

2743.zip

Original issue: go-swagger/go-swagger#2743

cc: @mateusbandeiraa

@fredbi fredbi self-assigned this Jan 8, 2024
fredbi added a commit to fredbi/spec that referenced this issue Jan 8, 2024
… resolution when SKipSchema

* fixes go-openapi#182
* contributes go-swagger/go-swagger#2743

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Jan 8, 2024
* fixes go-swagger#2743

This PR onboards the fix to go-openapi/spec#182:
 * invalid relative path in $ref in schema for parameters or response
   when SkipSchema=true (flatten use-case)

Added a test to assert that the fix works fine with the version update.

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit that referenced this issue Jan 9, 2024
… resolution when SKipSchema (#183)

* fix(expand): parameters & responses should properly follow remote doc resolution when SKipSchema

* fixes #182
* contributes go-swagger/go-swagger#2743

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>

* fixed assertion in test for windows paths

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>

---------

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to fredbi/go-swagger that referenced this issue Jan 9, 2024
* fixes go-swagger#2743

This PR onboards the fix to go-openapi/spec#182:
 * invalid relative path in $ref in schema for parameters or response
   when SkipSchema=true (flatten use-case)

Added a test to assert that the fix works fine with the version update.

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi added a commit to go-swagger/go-swagger that referenced this issue Jan 10, 2024
* fixes #2743

This PR onboards the fix to go-openapi/spec#182:
 * invalid relative path in $ref in schema for parameters or response
   when SkipSchema=true (flatten use-case)

Added a test to assert that the fix works fine with the version update.

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant