Skip to content

Regression in v10.1.1 when fully dereferencing external $ref #273

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

Open
nflaig opened this issue Apr 1, 2025 · 0 comments
Open

Regression in v10.1.1 when fully dereferencing external $ref #273

nflaig opened this issue Apr 1, 2025 · 0 comments

Comments

@nflaig
Copy link

nflaig commented Apr 1, 2025

I am using swagger-cli to build a json file from oapi definitions via

swagger-cli bundle ./beacon-node-oapi.yaml -r -t json -o ./deploy/beacon-node-oapi.json

Note the -r, which is used fully dereference all $ref pointers

The schema looks like this, see beacon-APIs/types/phase0/attestation_data.yaml

Phase0:
  AttestationData:
    type: object
    description: "The [`AttestationData`](https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/beacon-chain.md#attestationdata) object from the CL spec."
    required: [slot, index, beacon_block_root, source, target]
    properties:
      slot:
        $ref: "../primitive.yaml#/Uint64"
      index:
        $ref: "../primitive.yaml#/Uint64"
        example: "0" # <-- note this line
      beacon_block_root:
        $ref: '../primitive.yaml#/Root'
        description: "LMD GHOST vote."
      source:
        $ref: "../misc.yaml#/Checkpoint"
      target:
        $ref: "../misc.yaml#/Checkpoint"

primitive.yaml

Uint64:
  type: string
  example: "1"

The json output looks like this though, still containing the "1"

"index": {
    "type": "string",
     "example": "1"
},

Now I would expect the example to show "0" which with v10.1.0 was the case but no longer with v10.1.1 since swagger-cli does not pin the exact version this automatically bumped to the latest release

npm i -g @apidevtools/swagger-cli@4

Now I know this package is deprecated and we are looking to migrate soon but might be worth to report this here anyways.

Also potentially interesting, if I do not put Uint64 into an external file it works.

Current workaround is to add an override to package.json

 "devDependencies": {
    "@apidevtools/swagger-cli": "^4.0.4"
  },
  "overrides": {
    "@apidevtools/swagger-parser": "10.1.0"
  },
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

No branches or pull requests

1 participant