Skip to content
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

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

Open
blakew opened this issue Aug 23, 2022 · 0 comments

Comments

@blakew
Copy link

blakew commented Aug 23, 2022

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
  }
  ...
} 
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