Description
At the time of writing, the JSON schema does not provide a list of possible authentication providers:
data-api-builder/schemas/dab.draft.schema.json
Lines 275 to 299 in 0f4a3fd
- 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 start
is called, which badly affects the inner development loop. - This means there is also no validation of the auth provider name +
jwt
object combination forOAuth
providers, likeCustom
.- It would be great for a user to get an error in their editor when they use the
Custom
auth provider but haven't provided the requiredjwt
object.
- 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
jwt
whenCustom
is used, and also errors out when it is used for non-Custom
auth options as this isn't valid. - We need to add a test that checks that the use of the
jwt
object with non-Custom
auth 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! :)