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

Fix enum types in JSON schemas #1634

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/internal/newsfragments/1634.clarification
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix enum types in JSON schemas.
2 changes: 1 addition & 1 deletion data/api/client-server/definitions/sso_login_flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: object
title: m.login.sso flow schema
properties:
type:
type: enum
type: string
enum: ["m.login.sso"]
description: The string `m.login.sso`
example: "m.login.sso"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.device_list_update']
description: The string `m.device_list_update`.
example: "m.device_list_update"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.direct_to_device']
description: The string `m.direct_to_device`.
example: "m.direct_to_device"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.presence']
description: The string `m.presence`
example: "m.presence"
Expand All @@ -44,7 +44,7 @@ allOf:
description: The user ID this presence EDU is for.
example: "@john:matrix.org"
presence:
type: enum
type: string
enum: ['offline', 'unavailable', 'online']
description: The presence of the user.
example: "online"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.receipt']
description: The string `m.receipt`
example: "m.receipt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.signing_key_update']
description: The string `m.signing_update`.
example: "m.signing_key_update"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ allOf:
- type: object
properties:
edu_type:
type: enum
type: string
enum: ['m.typing']
description: The string `m.typing`
example: "m.typing"
Expand Down
9 changes: 1 addition & 8 deletions layouts/partials/openapi/render-object-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@
{{ $type = delimit (slice "[" $inner_type "]") "" }}
{{ end }}

{{/*
If the property is an enum, indicate this.
*/}}
{{ if (and (eq $property.type "string") ($property.enum)) }}
{{ $type = "enum" }}
{{ end }}

{{/*
Handle two ways of indicating "required", one for simple parameters,
the other for request and response body objects.
Expand All @@ -72,7 +65,7 @@
<td>
{{ if $required }}<strong>Required: </strong>{{end -}}
{{ $property.description | markdownify -}}
{{ if eq $type "enum"}}<p>One of: <code>[{{ delimit $property.enum ", " }}]</code>.</p>{{ end -}}
{{ if $property.enum }}<p>One of: <code>[{{ delimit $property.enum ", " }}]</code>.</p>{{ end -}}
{{ if (index $property "x-addedInMatrixVersion") }}{{ partial "added-in" (dict "v" (index $property "x-addedInMatrixVersion")) }}{{ end -}}
{{ if (index $property "x-changedInMatrixVersion") }}{{ partial "changed-in" (dict "changes_dict" (index $property "x-changedInMatrixVersion")) }}{{ end -}}
</td>
Expand Down
Loading