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
Bug 1830125: Add fallback create operand form if schema is missing or invalid #5287
Conversation
@TheRealJon: This pull request references Bugzilla bug 1830125, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/bugzilla refresh |
@TheRealJon: This pull request references Bugzilla bug 1830125, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @benjaminapetersen |
@@ -13,14 +13,6 @@ export const getSchemaErrors = (schema: JSONSchema6): SchemaError[] => { | |||
}, | |||
] | |||
: []), | |||
...(_.isArray(schema.type) |
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.
Swagger OpenAPI schema doesn't allow array types, so this check was not necessary.
@TheRealJon: This pull request references Bugzilla bug 1830125, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/retest |
/bugzilla refresh |
@TheRealJon: This pull request references Bugzilla bug 1830125, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold Something broke while rebasing |
/hold cancel Fixed |
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.
tested with BusinessAutomation/KieApp with success. lgtm
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
@@ -11,18 +11,17 @@ export const DEFAULT_K8S_SCHEMA: JSONSchema6 = { | |||
type: SchemaType.object, | |||
properties: { | |||
metadata: { | |||
type: '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.
These are just some magic strings I think I missed on initial implementation.
@@ -14,22 +14,14 @@ import { HIDDEN_UI_SCHEMA } from './const'; | |||
describe('getJSONSchemaOrder', () => { |
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.
Formatting and added another unit test to check an edge case in the hasNoFields
helper.
@@ -70,14 +62,14 @@ export const getDefaultUISchemaForPropertyName = (name) => | |||
|
|||
// Determine if a schema will produce an empty form field. | |||
export const hasNoFields = (jsonSchema: JSONSchema6): boolean => { | |||
const type = getSchemaType(jsonSchema ?? {}); | |||
const type = getSchemaType(jsonSchema ?? {}) ?? ''; |
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.
Default to empty string when type cannot be guessed and add new case in switch to handle it. If the schema type cannot be determined by getSchemaType
, the schema will not render any fields.
const handleArray = () => { | ||
return hasNoFields(jsonSchema.items as JSONSchema6); | ||
}; | ||
const handleObject = () => { | ||
return ( | ||
_.every(jsonSchema?.properties, hasNoFields) && | ||
_.every(jsonSchema?.additionalProperties as JSONSchema6, hasNoFields) | ||
hasNoFields(jsonSchema?.additionalProperties as JSONSchema6) |
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.
additionalProperties
is either boolean or JSONSchema6. It doesn't have nested schemas like properties
.
/hold Updating html id's used in the old form component so that they match the new implementation. This will help reduce test flakes since the current integration tests us id selectors to get form input values. |
@TheRealJon: This pull request references Bugzilla bug 1830125, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
@TheRealJon: This pull request references Bugzilla bug 1830125, which is valid. 3 validation(s) were run on this bug
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/hold cancel |
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
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.
/approve
/lgtm
I'll make a Jira for removing this in 4.6.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: benjaminapetersen, jcaianirh, TheRealJon 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 |
@TheRealJon: All pull requests linked via external trackers have merged: openshift/console#5287. Bugzilla bug 1830125 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Add the 4.4 operand form component as a fallback so that CRD's without a structural schema don't render a blank form.
This required a few small updates to the old form component as well as some other small bug fixes that were discovered during implementation:
frontend/public/components/utils/expandable-section.tsx
andfrontend/packages/operator-lifecycle-manager/src/components/descriptors/spec/field-group.tsx
. These were only used by the legacy form field group implementation.hasNoFields
where schemas with no valid type were returning false.hasNoFields
whereschema.additionalProperties
has a valid type, but function was returning true.