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
Stop autogenerating examples where we already have one #1384
Conversation
If an object definition already has an example, we shouldn't try to extend that definition by adding examples derived from the individual properties. Doing so is confusing, and there is no way to inhibit it when it is not desired. It's also not what the RapiDoc viewere does, so we end up with examples being inconsistent.
client_secret: | ||
type: string | ||
description: The client secret used in the session with the homeserver. | ||
example: "d0nt-T3ll" | ||
sid: | ||
type: string | ||
description: The session identifier given by the homeserver. | ||
example: "abc123987" | ||
required: ["client_secret", "sid"] | ||
example: { | ||
"sid": "abc123987", | ||
"client_secret": "d0nt-T3ll" | ||
} |
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.
this is so that we still get an example for auth
.
"auth": { | ||
"type": "example.type.foo", | ||
"session": "xxxxx", | ||
"example_credential": "verypoorsharedsecret" | ||
}, |
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.
again, this means that we still get an example for auth
.
example: { | ||
"client_secret": "monkeys_are_GREAT", | ||
"email": "foo@example.com", | ||
"send_attempt": 1 | ||
} |
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.
this is redundant (the individual fields all have examples), but also, this object is inherited elsewhere and this example was overriding the examples for the fields in the derived object.
example: { | ||
"client_secret": "monkeys_are_GREAT", | ||
"country": "GB", | ||
"phone_number": "07700900001", | ||
"send_attempt": 1 | ||
} |
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.
ditto
@@ -88,7 +88,6 @@ paths: | |||
The user\'s master cross-signing key. | |||
allOf: | |||
- $ref: ../client-server/definitions/cross_signing_key.yaml | |||
# FIXME: why isn't the doc generator picking up this example? |
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.
... this was why.
If an object definition already has an example, we shouldn't try to extend that definition by adding examples derived from the individual properties. Doing so is confusing, and there is no way to inhibit it when it is not desired. It's also not what the RapiDoc viewere does, so we end up with examples being inconsistent.
If an object definition already has an example, we shouldn't try to extend that
definition by adding examples derived from the individual properties. Doing so
is confusing, and there is no way to inhibit it when it is not desired. It's
also not what the RapiDoc viewer does, so we end up with examples being
inconsistent.
Preview: https://pr1384--matrix-spec-previews.netlify.app