-
Notifications
You must be signed in to change notification settings - Fork 26
Workflow: parameters as object not as string #151
Conversation
Required is set as "true" as string, but Backstage is not rendering it well, so moving to a native type and using Object instead of String. Example output: ``` { "id": "ffe20407-7af4-4a14-b6a8-e1c4c02cfaf5", "name": "simpleSequentialWorkFlow_INFRASTRUCTURE_WORKFLOW", "type": "INFRASTRUCTURE", "processingType": "SEQUENTIAL", "author": null, "createDate": "2023-03-23T14:05:40.325+00:00", "modifyDate": "2023-03-23T14:05:40.325+00:00", "works": [ { "id": "749705aa-7a2d-4ff2-8c7c-40369dfb50d8", "name": "restCallTask", "workType": "TASK", "parameters": { "payload": { "format": "text", "description": "Json of what to provide for data. (ie: 'Hello!')", "type": "string", "required": true }, "user-id": { "format": "text", "description": "The user id", "type": "string", "required": true }, "url": { "format": "url", "description": "The Url of the service (ie: https://httpbin.org/post", "type": "string", "required": true } }, "outputs": [ "HTTP2XX", "OTHER" ] }, { "id": "191a4f56-0653-4799-864b-9633141951ce", "name": "loggingTask", "workType": "TASK", "parameters": { "user-id": { "minLength": 1, "format": "text", "description": "The user id", "type": "string", "required": true, "maxLength": 64 }, "api-server": { "format": "url", "description": "The api server", "type": "string", "required": true } }, "outputs": [ "OTHER" ] } ] } ``` Let me highlight the required, minLength and maxLength parameters that are no longer string. Related to FLPATH-193 Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
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.
/lgtm
Map<String, String> properties = this.getType().getAsJsonSchema(); | ||
properties.put("required", String.valueOf(!this.isOptional())); | ||
Map<String, Object> properties = this.getType().getAsJsonSchema(); | ||
properties.put("required", !this.isOptional()); |
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.
Doubt: did you check if it's ok to put a boolean
instead of a Boolean
if the map expect Object
?
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.
I am not sure Java itself allows primitive types in Collections, but it may have change
Bit old but still relevant: https://stackoverflow.com/questions/2504959/why-can-java-collections-not-directly-store-primitives-types
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: eloycoto, lshannon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Required is set as "true" as string, but Backstage is not rendering it well, so moving to a native type and using Object instead of String.
Example output:
Let me highlight the required, minLength and maxLength parameters that are no longer string.
Related to FLPATH-193