Title: Question: OneOf · Issue #85 · JsonSchema-JavaUI/sf-java-ui · GitHub
Open Graph Title: Question: OneOf · Issue #85 · JsonSchema-JavaUI/sf-java-ui
X Title: Question: OneOf · Issue #85 · JsonSchema-JavaUI/sf-java-ui
Description: After the objects are serialized to JsonSchema, I need to add another field. BEFORE: { "schema": { "type": "object", "id": "urn:jsonschema:io:asfjava:ui:core:schema:Conditional", "properties": { "needColor": { "type": "boolean" }, "color...
Open Graph Description: After the objects are serialized to JsonSchema, I need to add another field. BEFORE: { "schema": { "type": "object", "id": "urn:jsonschema:io:asfjava:ui:core:schema:Conditional", "properties": { "n...
X Description: After the objects are serialized to JsonSchema, I need to add another field. BEFORE: { "schema": { "type": "object", "id": "urn:jsonschema:io:asfjava:ui...
Opengraph URL: https://github.com/JsonSchema-JavaUI/sf-java-ui/issues/85
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Question: OneOf","articleBody":"After the objects are serialized to JsonSchema, I need to add another field. \r\n\r\nBEFORE:\r\n\r\n {\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"id\": \"urn:jsonschema:io:asfjava:ui:core:schema:Conditional\",\r\n \"properties\": {\r\n \"needColor\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"color\": {\r\n \"type\": \"string\",\r\n \"title\": \"Color\"\r\n },\r\n \"length\": {\r\n \"type\": \"string\",\r\n \"title\": \"Length\"\r\n }\r\n }\r\n },\r\n \"form\": [\r\n {\r\n \"key\": \"length\"\r\n },\r\n {\r\n \"key\": \"color\",\r\n \"type\": \"select\",\r\n \"autofocus\": false,\r\n \"disabled\": false,\r\n \"multiple\": false,\r\n \"required\": false,\r\n \"size\": 1,\r\n \"titleMap\": [\r\n {\r\n \"name\": \"Red\",\r\n \"value\": \"red\"\r\n },\r\n {\r\n \"name\": \"Blue\",\r\n \"value\": \"blue\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n\r\nAFTER \r\n\r\n {\r\n \"schema\": {\r\n \"type\": \"object\",\r\n \"id\": \"urn:jsonschema:io:asfjava:ui:core:schema:Conditional\",\r\n \"properties\": {\r\n \"needColor\": {\r\n \"type\": \"boolean\"\r\n },\r\n \"color\": {\r\n \"type\": \"string\",\r\n \"title\": \"Color\"\r\n },\r\n \"length\": {\r\n \"type\": \"string\",\r\n \"title\": \"Length\"\r\n }\r\n },\r\n \"oneOf\": \r\n [\r\n {\r\n \"properties\": {\r\n \"needColor\": { \"enum\": [true] }\r\n },\r\n \"required\": [\"color\"]\r\n },\r\n {\r\n \"properties\": {\r\n \"needColor\": { \"enum\": [false] }\r\n },\r\n \"required\": [\"length\"]\r\n }\r\n ]\r\n },\r\n \"form\": [\r\n {\r\n \"key\": \"length\"\r\n },\r\n {\r\n \"key\": \"color\",\r\n \"type\": \"select\",\r\n \"autofocus\": false,\r\n \"disabled\": false,\r\n \"multiple\": false,\r\n \"required\": false,\r\n \"size\": 1,\r\n \"titleMap\": [\r\n {\r\n \"name\": \"Red\",\r\n \"value\": \"red\"\r\n },\r\n {\r\n \"name\": \"Blue\",\r\n \"value\": \"blue\"\r\n }\r\n ]\r\n }\r\n ]\r\n }\r\n\r\nI found the following example (https://github.com/FasterXML/jackson-module-jsonSchema/blob/master/src/main/java/com/fasterxml/jackson/module/jsonSchema/customProperties/TitleSchemaFactoryWrapper.java) of injecting a new property into a JsonSchema but it uses the schema.asSimpleTypeSchema().setTitle() method which is not the same thing as injecting a brand new property.\r\n\r\nThe oneOf field would allow me to do some conditional validation on the front end. Do you know of a way to do this? I understand it's a little outside the scope of the current project. Side note: I am generating this schema for https://angular2-json-schema-form.firebaseapp.com (as opposed to Angular Schema Form). Angular2 supports the same schema format which is why I can use sf-java-ui, but also has a limited implementation of oneOf.\r\n\r\n","author":{"url":"https://github.com/lbispham","@type":"Person","name":"lbispham"},"datePublished":"2018-03-14T16:09:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/85/sf-java-ui/issues/85"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4db8626a-2c0c-e1e2-6223-9b9a9e6f4aa7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9780:4D8F0:10BC1F7:1783AB2:698214E3 |
| html-safe-nonce | c4277b35a4bdd96f96696a4ad6de006e552031c9839c1244875c97aaa919a053 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzgwOjREOEYwOjEwQkMxRjc6MTc4M0FCMjo2OTgyMTRFMyIsInZpc2l0b3JfaWQiOiIyMDk4Njc5MTI4OTMxODMzMDU5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4e443a43e29708efd57edb5087ee0c418e3a7848460aa8ff07ced61d9c3833d8 |
| hovercard-subject-tag | issue:305226207 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JsonSchema-JavaUI/sf-java-ui/85/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6a1810cf4488b46ac13bfb7ebc4644e0ad78c193e57153c9e0c6f4861939cde6/JsonSchema-JavaUI/sf-java-ui/issues/85 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6a1810cf4488b46ac13bfb7ebc4644e0ad78c193e57153c9e0c6f4861939cde6/JsonSchema-JavaUI/sf-java-ui/issues/85 |
| og:image:alt | After the objects are serialized to JsonSchema, I need to add another field. BEFORE: { "schema": { "type": "object", "id": "urn:jsonschema:io:asfjava:ui:core:schema:Conditional", "properties": { "n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lbispham |
| hostname | github.com |
| expected-hostname | github.com |
| None | c5d01132ac10b0b45b88f4c1c8790502d669eb065ff383dc5e4757c174f3380f |
| turbo-cache-control | no-preview |
| go-import | github.com/JsonSchema-JavaUI/sf-java-ui git https://github.com/JsonSchema-JavaUI/sf-java-ui.git |
| octolytics-dimension-user_id | 28846876 |
| octolytics-dimension-user_login | JsonSchema-JavaUI |
| octolytics-dimension-repository_id | 91987646 |
| octolytics-dimension-repository_nwo | JsonSchema-JavaUI/sf-java-ui |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 91987646 |
| octolytics-dimension-repository_network_root_nwo | JsonSchema-JavaUI/sf-java-ui |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0ac87bbde7c9f04b7ead5505c12f56048d89df09 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width