Skip to content
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

Improve documentation for hydra responses #1663

Open
retendo opened this issue Dec 11, 2019 · 0 comments
Open

Improve documentation for hydra responses #1663

retendo opened this issue Dec 11, 2019 · 0 comments

Comments

@retendo
Copy link

@retendo retendo commented Dec 11, 2019

Is your feature request related to a problem? Please describe.

When I'm consuming hydra APIs I would like to know which fields in the response json can be optional/null/absent, so that I can model my types properly on the consumer side.

For some responses there is a proper description of the fields in the documentation.
For example for login request responses there are already helpful comments

{
    // Skip, if true, let's us know that ORY Hydra has successfully authenticated the user and we should not show any UI
    "skip": true|false,

    // The user-id of the already authenticated user - only set if skip is true
    "subject": "user-id",

    ...
}

This information lets me model this as

type Subject = string

type HydraLoginContinuation =
| Skip of Subject
| Continue

type HydraLoginRequest = {
    Continuation: HydraLoginContinuation
    ...
}

otherwise it would look like this:

type HydraLoginRequest = {
    Skip: bool option
    Subject: string option
    ...
}

That is all great, but I would like this information for all fields in all response objects.
After the sample json in the documentation it says

For a full documentation on all available keys, please head over to the API documentation (make sure to select the right API version).

But the API documentation doesn't give me the information I need:
https://www.ory.sh/docs/hydra/sdk/api#loginrequest

Describe various solutions you'd like

This information belongs in the API documentation.
Possible solutions:
a. Right now there is "Required" column that always seems to be false. We could use that value to indicate that a field will always be present in the response and that it has a non-null value.
b. We could postfix Name or Type values with "(optional)"
c. We could prefix Description value with "(optional)"

More opinions

I think this should apply to at least all endpoints of all ory services that are not supposed to be consumed by a standard library (like oauth2/token etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.