You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by risabhds July 23, 2024
I have the following typespec in my playground:
import"@typespec/json-schema";usingTypeSpec.JsonSchema;
@jsonSchemanamespaceSchemas;/** Description goes here */
@summary("Title goes here")modelPerson{/** The person's name. */
@example("John")name: string;/** Age in years which must be equal to or greater than zero. */
@example(18)
@minValue(0)age: integer;}
But I don't get examples in the emitted json-schema.
What I desire is a json-schema with examples on the property:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "Person.json",
"description": "Description goes here",
"title": "Title goes here",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The person's name.",
"examples": ["John"]
},
"age": {
"type": "integer",
"minimum": 0,
"description": "Age in years which must be equal to or greater than zero.",
"examples": [18]
}
},
"required": [
"name",
"age"
]
}
How do I get examples in the emitted json-schema?
The text was updated successfully, but these errors were encountered:
Discussed in #3944
Originally posted by risabhds July 23, 2024
I have the following typespec in my playground:
But I don't get
examples
in the emitted json-schema.What I desire is a json-schema with
examples
on the property:How do I get
examples
in the emitted json-schema?The text was updated successfully, but these errors were encountered: