Skip to content

Conversation

@tx3stn
Copy link
Contributor

@tx3stn tx3stn commented Jan 29, 2026

Me again with an edge-casey one.

Example schemas that use openapi keywords don't get in-lined during bundling, so give this spec:

openapi: 3.0.0
info:
  title: Test API
  version: 1.0.0
paths:
  /test:
    get:
      responses:
        '200':
          description: Success
          content:
            application/json:
              example:
                $ref: './example.yaml'

and the external example ref:

"items":
  - id: 1
    name: "test"
  - id: 2
    name: "example"

This gets bundled as:

components:
  schemas:
    example:
      items: {}

Items is an empty object, so the example is lost.

The usual way of handling reserved words in yaml is quoting them, however this isn't currently handled by the bundling so quoting the items key makes no difference.

So, I've added logic to getNodeKeys to check if the node is quoted, which means after this change the above example gets properly inlined, like:

paths:
  /test:
    get:
      responses:
        '200':
          description: Success
          content:
            application/json:
              example:
                'items':
                  - id: 1
                    name: "test"
                  - id: 2
                    name: "example"

So now if someone has an example which contains a field using an openapi keyword, they can quote it, and it will get properly bundled.

@codecov
Copy link

codecov bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.50%. Comparing base (7b6048a) to head (c30f1e3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #512   +/-   ##
=======================================
  Coverage   99.50%   99.50%           
=======================================
  Files         190      190           
  Lines       23013    23016    +3     
=======================================
+ Hits        22900    22903    +3     
  Misses         68       68           
  Partials       45       45           
Flag Coverage Δ
unittests 99.50% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@daveshanley daveshanley left a comment

Choose a reason for hiding this comment

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

Nice! This is super edgy. I would never have found this.

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