Skip to content

$ref in fields replaces all attributes, instead of merge #14

@jharmn

Description

@jharmn

Scenario 1:

In this example, we use x-nullable as a vendor extension to represent when a field is allowed to have an expressly null value. As it stands now, we have to make address.yaml contain this property for all uses (which is bad, because it's not always nullable).

# item.yaml
shipping_address:
  x-nullable: true  # I will be killed by the following $ref
  $ref: "address.yaml"
# address.yaml
  description: A generic address
  properties:
    # fields here

Once this is deferenced, x-nullable has disappeared. It seems like this should be a merge, to allow for overrides as well.

# item.yaml
shipping_address:
  description: A generic address
  properties:
    # fields here

Scenario 2:

When using generic/common objects, it's nice to provide usage-specific descriptions. Today we have to use one description for all uses, as the description will be stripped by dereferencing.

# item.yaml
shipping_address:
  description: Shipping address for the item  # I will disappear after $ref resolves
  $ref: "address.yaml"

After dereferencing, this will strip off the overriden description:

# item.yaml
shipping_address:
  description: A generic address
  properties:
    # fields here

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