mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-03-23 11:34:09 +01:00
Rename custom-formats to string-formats
It does not contain only custom formats, so the name didn't fit anymore. Update also the docs to reflect that. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
69d7dbf703
commit
91c40bb6d0
|
|
@ -12,15 +12,26 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
# This file contains the list of custom formats supported for the `format` key
|
# This file contains the list of string formats supported for the `format` key
|
||||||
# and the `x-pattern-format` extension (see `openapi_extensions.md` for more
|
# and the `x-pattern-format` extension (see `openapi_extensions.md` for more
|
||||||
# details).
|
# details).
|
||||||
#
|
#
|
||||||
# Each entry must use the `mx-` prefix and have the form:
|
# Custom formats defined in the Matrix specification should always use the `mx-`
|
||||||
|
# prefix. They should link to the section containing the definition of the
|
||||||
|
# format in the spec.
|
||||||
#
|
#
|
||||||
# mx-custom-key:
|
# Formats that are already supported in the JSON Schema specification should
|
||||||
|
# link to the RFC where they are defined, and should not use a regex to allow
|
||||||
|
# tools that recognize the format to validate it properly.
|
||||||
|
# See <https://json-schema.org/understanding-json-schema/reference/string#built-in-formats>.
|
||||||
|
#
|
||||||
|
# All entries have the form:
|
||||||
|
#
|
||||||
|
# key:
|
||||||
# title: The title rendered in the specification
|
# title: The title rendered in the specification
|
||||||
# url: /url/to#definition
|
# url: /url/to#definition
|
||||||
|
# # regex: A regex that can be used to validate the custom format if possible.
|
||||||
|
# It should be used as the `pattern` of the string.
|
||||||
|
|
||||||
mx-user-id:
|
mx-user-id:
|
||||||
title: User ID
|
title: User ID
|
||||||
|
|
@ -50,4 +61,3 @@ mx-mxc-uri:
|
||||||
uri:
|
uri:
|
||||||
title: URI
|
title: URI
|
||||||
url: http://tools.ietf.org/html/rfc3986
|
url: http://tools.ietf.org/html/rfc3986
|
||||||
# no regex
|
|
||||||
|
|
@ -157,7 +157,7 @@ resolve-additional-types.)
|
||||||
|
|
||||||
{{/* If the string uses a known format, use it. */}}
|
{{/* If the string uses a known format, use it. */}}
|
||||||
{{ with .format }}
|
{{ with .format }}
|
||||||
{{ with partial "custom-format" . }}
|
{{ with partial "string-format" . }}
|
||||||
{{ $type = . }}
|
{{ $type = . }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -264,7 +264,7 @@ resolve-additional-types.)
|
||||||
{{ range $formatId, $formatType := $formatMap.Values }}
|
{{ range $formatId, $formatType := $formatMap.Values }}
|
||||||
{{ $formatKey := "string" }}
|
{{ $formatKey := "string" }}
|
||||||
{{ if ne $formatId "string" }}
|
{{ if ne $formatId "string" }}
|
||||||
{{ with partial "custom-format" $formatId }}
|
{{ with partial "string-format" $formatId }}
|
||||||
{{ $formatKey = . }}
|
{{ $formatKey = . }}
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }}
|
{{ errorf "Unsupported value for `x-pattern-format`: %s" $formatId }}
|
||||||
|
|
@ -319,12 +319,12 @@ resolve-additional-types.)
|
||||||
Computes the type to display for a string format, given the identifier of
|
Computes the type to display for a string format, given the identifier of
|
||||||
the format as a string.
|
the format as a string.
|
||||||
*/}}
|
*/}}
|
||||||
{{ define "partials/custom-format" }}
|
{{ define "partials/string-format" }}
|
||||||
{{ $customFormat := "" }}
|
{{ $stringFormat := "" }}
|
||||||
|
|
||||||
{{ with index site.Data "custom-formats" . }}
|
{{ with index site.Data "string-formats" . }}
|
||||||
{{ $customFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
|
{{ $stringFormat = printf "<a href=\"%s\">%s</a>" (htmlEscape .url) (htmlEscape .title) }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ return $customFormat }}
|
{{ return $stringFormat }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
||||||
|
|
@ -39,5 +39,5 @@ is a property to convey semantic information about a schema. We define
|
||||||
`x-pattern-format` as a key on the schemas under `patternProperties` with the
|
`x-pattern-format` as a key on the schemas under `patternProperties` with the
|
||||||
same use as `format`, but that applies to the pattern of the property. We also
|
same use as `format`, but that applies to the pattern of the property. We also
|
||||||
define custom values for formats with the `mx-` prefix in
|
define custom values for formats with the `mx-` prefix in
|
||||||
`data/custom-formats.yaml`. Those values are recognized in the rendered
|
`data/string-formats.yaml`. The values in this file are recognized in the
|
||||||
specification and link to the definition of the format.
|
rendered specification and link to the definition of the format.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue