Maybe we should add some regex patterns for server host and pathname
derberg opened this issue · 5 comments
in spec v3 we have new fields in Server Object:
- host
- pathname
in json schema we do not have any basic validation: https://github.com/asyncapi/spec-json-schemas/blob/next-major-spec/definitions/3.0.0/server.json#L15-L22
I think we should have at least some basic, that will fail if someone uses host
the same way as it was with url
, so localhost:3000/ws
would be an error
JSON schema format keywords, might not be good, as hostname
I think should be without port for example. I'm not 100% sure what formats from https://json-schema.org/understanding-json-schema/reference/string#built-in-formats we can reuse, thus suggesting patterns
Also in specification we are not so detailed and accurate, not pointing to standards like JSON Schema
cc @fmvilas that introduced a change in spec
cc @jonaslagoni release coordinator
cc @magicmatatjahu who I think introduced changes in json schemas
cc codeowners of the json schemas @dalelane @char0n @smoya
JSON schema format keywords, might not be good, as
hostname
I think should be without port for example
Yeah, it doesn't contemplate ports. Only the first human-readable section. So 👍 to use a pattern.
for host it should be easy, just pattern that complains when /
is added. With pathname? patter that just complains if it do not start with/
?
yeah, makes sense - I suspect that might help catch some instances of people mistakenly cramming everything into host without realising
Duplicate of #336