-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use JSON Schema oneOf schematic instead of enum & enumNames [#183287493] #335
Conversation
@aorin Would be good to check if this breaks 1) label designed 2) vihko import |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I tested the Vihko import and it seems to work. Because there are changes to label designer, we must remember to update the label designer npm package before the update (can't do it before merging to development since there are other pull requests with changes to label designer).
enum: string[]; | ||
enumNames: string[]; | ||
} | ||
export type IEnum = {const: string; title: string}[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this interface be oneOf: {const: string; title: string}[];
(like in the file projects/laji-api-client/src/lib/models/UISchemaContext.ts
above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - it worked as it was, but I made it like you assumed since that makes sense. So the areas are now served as proper schema (wrapped into a oneOf
object instead of just const
& title
pairs). I fixed this on also on laji-form side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because there are changes to label designer, we must remember to update the label designer npm package before the update
Right. The label designer schema service is used only on laji.fi, not on Kotka right? Does laji.fi use the label-designer from the npm package, or from directly from the source? If it uses the label designer from npm, we have to make a release for it and include a dependency update to this PR... It's in package.json deps at least so I assume we have to do it that way. So this PR is recursively depending on it's changes. Pretty crazy stuff!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct but this pull request needs to be merged first because I made release 4.0.6 for label designer there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so I'll merge that to dev now and then merge dev here.
…form to handle it also
https://183287493.dev.laji.fi/
https://www.pivotaltracker.com/story/show/183287493
Form backend received changes so that the schema format has changed form enums like this:
enum: ["MX.a", "MX.b"], enumNames: ["aLabel", "bLabel"]
will be like this:
oneOf [{const: "MX.a", title: "aLabel"}, {const: "MX.b", title: "bLabel"}]
Reasoning (copy-pasted from pivotal):