Add Authentication providers to JSON schema for autocomplete and validation
At the time of writing, the JSON schema does not provide a list of possible authentication providers:
https://github.com/Azure/data-api-builder/blob/0f4a3fd507cbf67b0a36b5f02649ba175e10600b/schemas/dab.draft.schema.json#L275-L299
- This means that the user needs to read the documentation (or the source code) to find out all possible values, which is a bad developer experience
- This means that there is no validation for the auth provider name until
dab startis called, which badly affects the inner development loop. - This means there is also no validation of the auth provider name +
jwtobject combination forOAuthproviders, likeCustom.- It would be great for a user to get an error in their editor when they use the
Customauth provider but haven't provided the requiredjwtobject.
- It would be great for a user to get an error in their editor when they use the
These issues all have unit tests and are validated at dab start. Adding these cases to the JSON Schema will make it easier for developers to understand the authentication options, reduce time needed to fix issues as validation will take place in the editor as well, and make it easier to use Custom validation as the required jwt option would be pointed out by the schema.
This change doesn't seem like it would be to difficult to implement. As far as I know:
- We need to add a list of auth providers to the JSON schema
- We need to add conditional logic to the JSON schema that errors out when devs forget to add
jwtwhenCustomis used, and also errors out when it is used for non-Customauth options as this isn't valid. - We need to add a test that checks that the use of the
jwtobject with non-Customauth providers throws an error.
I'd love to work on this in a while, when I'm done with moving houses and have some more headspace! :)