Skip to content

FR: allow changing discriminators in an existing resource (via additionalProperties in MergePatch) #34

@blakew

Description

@blakew

Because different discriminator values can have different schemas, our current strategy of applying basic JSON merge-patch fails when users change the discriminator and (therefore the schema).

Ex:

ex. target:
{
  ...
  limit: {
    method: 'row_count',
    threshold: 1000
  }
  ...
} 
PATCH:
{
  ...
  limit: {
    method: 'percentile',
    percentile: 80
  }
  ...
} 

AJV complains that percentile isn't valid because it's seeing both threshold and percentile when applying naive json merge-patch.

Per @emk - The basic fix here is for all MergePatch types to start allowing additionalProperties: { type: null }.

Then this would work, for ex:

PATCH ...

{
  ...
  limit: {
    method: 'percentile',
    percentile: 80,
    threshold: null
  }
  ...
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions