Skip to content

Intended behaviour when $ref alongside other keywords? #168

@jamescrowley

Description

@jamescrowley

I've noticed that this library will de-reference $ref alongside other properties like this:

properties:
  $ref: "common.yaml"
  message_type:
    type: string

and in common.yaml

someCommonProp:
   type: string

becomes

properties:
  message_type:
    type: string
  someCommonProp:
    type:string

For context, I was using $ref in the above way, and looking to 'fix' the ordering of someCommonProp in the resulting document, before realising that this is 'mis-using' $ref (to my current understanding)

According to JSON Reference spec

Any members other than "$ref" in a JSON Reference object SHALL be ignored.

Is there a current intended behaviour here?

I noted there's an issue regarding supporting the 2019-09 JSON Schema spec - #145 - which changes the approach to this, for which the above behaviour wouldn't be compatible with (from my limited understanding).

I just thought I'd flag the issue here, as it seems like we'd be on our way to making a breaking change to possibly undocumented behaviour that others also mistakenly rely on?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions