Why do we need this improvement?
groupId and clientId are typed as Schema Object. But these are configuration
values, not a data schema. Expressing a consumer group name requires unnecessary
JSON Schema boilerplate when a plain string would do.
# what you have to write today
groupId:
type: string
enum: ['payments-consumer-group']
# what you actually mean
groupId: 'payments-consumer-group'
How will this change help?
The intent is immediately readable in the document.
Screenshots
No response
How could it be implemented/designed?
Allow groupId and clientId to accept a plain string, an array of strings,
or the existing Schema Object form.
# plain string
groupId: 'payments-consumer-group'
# array of strings
groupId:
- 'payments-consumer-group-1'
- 'payments-consumer-group-2'
# existing Schema Object form, still valid
groupId:
type: string
enum: ['payments-consumer-group']
In spec-json-schemas, the property definition becomes a oneOf:
"groupId": {
"oneOf": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" }, "minItems": 1 },
{ "$ref": "http://asyncapi.com/definitions/3.0.0/schema.json" }
],
"description": "Id of the consumer group."
}
The same change applies to clientId.
New and updated tooling should resolve the three forms in order: plain string
first, then array of strings, then treat an object as a Schema Object. A plain
string and an array can never be mistaken for a Schema Object, so existing
tooling that only handles the object form continues to work without any changes.
🚧 Breaking changes
No
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue?
Yes I am willing to submit a PR!
Why do we need this improvement?
groupIdandclientIdare typed as Schema Object. But these are configurationvalues, not a data schema. Expressing a consumer group name requires unnecessary
JSON Schema boilerplate when a plain string would do.
How will this change help?
The intent is immediately readable in the document.
Screenshots
No response
How could it be implemented/designed?
Allow
groupIdandclientIdto accept a plain string, an array of strings,or the existing Schema Object form.
In
spec-json-schemas, the property definition becomes aoneOf:The same change applies to
clientId.New and updated tooling should resolve the three forms in order: plain string
first, then array of strings, then treat an object as a Schema Object. A plain
string and an array can never be mistaken for a Schema Object, so existing
tooling that only handles the object form continues to work without any changes.
🚧 Breaking changes
No
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue?
Yes I am willing to submit a PR!