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

WIP: Fix expand remote #137

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Commits on Jan 5, 2021

  1. circular $ref expansion: fixed edge cases

    * fixes go-openapi#94
    
    * now expanded $ref's are always contained in the resulting document.
      All circular $ref that used to resolve to a remote $ref now resolve
      as a json pointer inside the expanded document. Pointer resolution
      prefers pointers to definitions.
    
    * added additional test case for remote cyclical $ref, from azure API
    
    * schema IDs are removed from the expanded spec: schemas expanded from some schema ID reference
      now refer to the new expanded root document.
    
    * circular IDs are resolved against the corresponding root document.
    
    > NOTE(1): uncovered pre-existing issue with nested schema ID involving cyclical references.
    > This case remains unsupported and is illustrated by test case: circular_test.go#L198 ("withID")
    
    > NOTE(2): pre-existing issue with non-deterministic expansion remains unsolved,
    > although the election of the replacing pointer inside the root document
    > somewhat reduces the scope of this problem.
    >
    > This case remains illustrated by a minimal test case: circular_test.go#L46 ("minimal"),
    > which expands correctly, but with changing results.
    
    > NOTE(3): notice that expansion is still not an idempotent transform, in the presence
    > of cyclical $ref's: another run on an expanded spec with remaining cyclical $ref
    > will expand further down and detect again the cycle.
    >
    > The result remains functionally correct, as illustrated by test case: circular_test.go#L168 ("CircularID").
    > Notice that this test case reproduces a validation fixture from jsonschema test (passed by go-openapi/validate).
    
    Signed-off-by: Frederic BIDON <[email protected]>
    fredbi committed Jan 5, 2021
    Configuration menu
    Copy the full SHA
    e606f6b View commit details
    Browse the repository at this point in the history