Skip to content

fix(15303): Ensure that all defaults for the forms come from the OpenAPI schemas #16

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

Merged
merged 17 commits into from
Jul 19, 2023

Conversation

vanch3d
Copy link
Contributor

@vanch3d vanch3d commented Jul 17, 2023

See https://hivemq.kanbanize.com/ctrl_board/57/cards/15303/details/

This PR changes all the React-Hook-Form forms in the web app (Bridge and Universal Names, Protocol being handled differently) so that their default values are exclusively coming from the OpenAPI specs. For example:

clientId: { type: 'string', description: `The client identifier associated the the MQTT connection.`, isNullable: true, format: 'string', maxLength: 65535, pattern: '([a-zA-Z_0-9\\-])*', },

The changes also imposed the standardisation of the error messages, for example:

 "validation": {
    "required": "This property is required",
    "maxLength": "No more than {{ count }} characters allowed for the property",
    "minimum": "Should be at least {{ count }}",
    "maximum": "Should not be more than {{ count }}",
    "pattern": "Should match the regular expression {{ pattern }}"
  }

Note that, as of v0.25.0, openapi-typescript-codegen used to generate the OpenAPI stubs still mishandles default values set to 0. See ferdikoomen/openapi-typescript-codegen#1558

@vanch3d vanch3d force-pushed the fix/15303/regex-openapi branch from 4c1dbf1 to b543057 Compare July 19, 2023 09:51
@vanch3d vanch3d self-assigned this Jul 19, 2023
@vanch3d vanch3d force-pushed the fix/15303/regex-openapi branch from b543057 to dbae218 Compare July 19, 2023 15:51
@vanch3d vanch3d merged commit 1169740 into master Jul 19, 2023
@vanch3d vanch3d deleted the fix/15303/regex-openapi branch July 19, 2023 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant