-
Notifications
You must be signed in to change notification settings - Fork 107
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
Add JSON-Schema create-params and a common Validate Credentials API #551
Add JSON-Schema create-params and a common Validate Credentials API #551
Conversation
1f38b78
to
78a5956
Compare
cc @skateman |
ca6efea
to
78a5956
Compare
Liking this approach! |
I like it too, but RSpec doesn't 😕 what about @Hyperkid123? |
The schema looks good. Is there supposed to be some validation? |
@Hyperkid123 that's coming in a separate PR here, I'll expose it in an API PR soon. |
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 started playing with this from the API and found out that the DDF schema doesn't really match the structure of the arguments of the validation method. With this approach we should have some logic on the frontend that does the conversion and that's something we already have and we'd like to get rid of.
I do not think that we need the schema to be the DDF schema. Rather I'd have something simple that we can use to generate the final DDF schema with some whistles and bells. Wdyt, @skateman, @Hyperkid123? |
30b05a2
to
2814656
Compare
@martinpovolny i am not really against using something different as long as we use something explicit. I would like to avoid having something ambiguous (like the mozzila schema). We should probably consider if this is purely for UI purposes or is there any other reason why would want this? If there is i would consider thinking about something else. Otherwise i don't see a reason why not to use ddf. |
@Hyperkid123 how to do optional parameters in DDF? I'd like to add proxy-uri and assume-role but they're not required |
@agrare Do you mean optional in a way that the fields are there but they user does not have to fill them or if someone chooses some option from select for instance and then another field appears? If you mean the first case: By default all fields are optional (as in they are not required). If you wan to add required validation you must add validator and additional properties for the component to add visual representation (for required the *). example: {
component: 'text-field',
name: 'field',
label: 'Validated field!',
isRequired: true,
validate: [
{
type: 'required-validator',
}
]
} http://data-driven-forms.surge.sh/renderer/validators#requiredvalidator |
Oh okay awesome thanks @Hyperkid123 |
08831ba
to
43d34bb
Compare
@agrare Should we validate the incoming parameters against the DDF schema? |
That'd be great, @Hyperkid123 is there a helper utility to check the data-types that are passed in? |
@agrare yes. Currently we have just a limited amount of data types but we can add some if we need: http://data-driven-forms.surge.sh/renderer/data-types What data-types are we talking about? Or do you want to just check the if the string is URL for instance? For that we have a number of different validators we can use. |
25501a1
to
a0316ef
Compare
@Hyperkid123 most likely just that a parameter is a string, is a url string, or is an integer (port). |
@Fryguy you want to do ddf validation that in a follow-up? |
@agrare All values are strings by default. There is no data-type URL in JS, but we can add url validator: http://data-driven-forms.surge.sh/renderer/validators#urlvalidators There is a lot of params for URL validator like port, host, if ip address is valid, etc. Let me know what url format you want and we can add it. |
Regarding the validation it would be really sweet if we had a DFF -> Hash validation class on the Ruby side. Unfortunately, you'd need a Ruby implementation of each validator, but this would get us server-side validation (to help with direct-api calls) in addition to the client-side validation. |
Checked commits agrare/manageiq-providers-amazon@7bb21a2~...1127b71 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
Add a set of parameters required by the UI to drive their data-driven-forms and implement the common validate_credentials API instead of raw_connect.