Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(canonical-title-map): add use case for enumNames #8

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

Open
jmfrancois wants to merge 2 commits into json-schema-form:development
base: development
Choose a base branch
Loading
from jmfrancois:jmfrancois/enumNames
Open

fix(canonical-title-map): add use case for enumNames #8

jmfrancois wants to merge 2 commits into json-schema-form:development from jmfrancois:jmfrancois/enumNames

Conversation

Copy link

@jmfrancois jmfrancois commented Dec 11, 2017

Description

Add support case for enumNames.
Spec: json-schema-org/json-schema-spec#57

We have some schemas with the following shape:

{
 "jsonSchema": {
 "type": "object",
 "title": "Datalist",
 "properties": {
 "test": {
 "type": "string",
 "enum": [ "a", "p", "b", "c", "l", "g" ],
 "enumNames": [ "Apple", "Pine[apple]", "Banana", "Cher[ry", "Lemo}n", "Grapefruit" ]
 }
 },
 "required": [
 "test"
 ]
 },
 "uiSchema": [
 {
 "key": "test",
 "title": "Datalist with named options",
 "widget": "datalist"
 }
 ],
 "properties": {
 "test": "Pine[apple]"
 }
}

This raise exception with the current implementation because we have an array of value for the titleMap;

Checklist

  • I have read and understand the CONTRIBUTIONS.md file
  • I have searched for and linked related issues
  • I have created test cases to ensure quick resolution of the PR is easier
  • I am NOT targeting master branch
  • I did NOT include the dist folder in my PR

@json-schema-form/angular-schema-form-lead

jsomsanith-tlnd and mrjj reacted with thumbs up emoji
@@ -14,6 +14,17 @@ export default function(titleMap: Array<any>, originalEnum?: any) {
});
}
return canonical;
} else if (originalEnum) {
const canonical = [];
Copy link

@scottux scottux Jan 10, 2018
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This definition of canonical doesn't seem to be used. I think it is safe to remove it.

if (typeof titleMap[index] === 'string') {
return {
name: titleMap[index],
value,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove trailing comma here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@scottux scottux scottux left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /