Broken schema since v0.91
See original GitHub issueThe schema output broke for me since the addition of functions. Here’s a simple example:
export enum DurationUnit {
Hour,
Minute,
Second,
}
export interface Duration {
value: number;
unit: DurationUnit;
}
export function durationOf(value: number, unit?: DurationUnit): Duration {
return { value: value, unit: unit ?? DurationUnit.Minute };
}
Which used to generate:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"DurationUnit": {
"type": "number",
"enum": [0, 1, 2]
},
"Duration": {
"type": "object",
"properties": {
"value": { "type": "number" },
"unit": { "$ref": "#/definitions/DurationUnit" }
},
"required": ["value", "unit"],
"additionalProperties": false
}
}
}
But since v0.91, this is what I get:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"DurationUnit": {
"type": "number",
"enum": [0, 1, 2]
},
"Duration": {
"type": "object",
"properties": {
"value": { "type": "number" },
"unit": { "$ref": "#/definitions/DurationUnit" }
},
"required": ["value", "unit"],
"additionalProperties": false
},
"*": {
"type": "object",
"properties": {
"value": { "type": "number" },
"unit": { "$ref": "#/definitions/DurationUnit" }
},
"required": ["value"],
"additionalProperties": false
}
}
}
Any idea what’s wrong?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Releases · ent/ent - GitHub
v0.8.0 ... This release contains several bug fixes, performance and runtime improvements, and multiple new features in ent/schema and ent-codegen. The next ...
Read more >Release listing - schema.org
Issue #1991: Fixed incorrect links (to webschemas.org) in docs/releases.html. Issue #1993: Updated definition and provided examples for isBasedOn property.
Read more >Changelog - pydantic
Revert Breaking Change: v1.9.1 introduced a breaking change where model fields were ... field schema, pass optional field argument (of type pydantic.fields.
Read more >Methodology for GHG and Co-Benefits in Grazing Systems
Version: 0.91 ... A schema for the measurement-based approach to estimate changes in SOC stocks is presented in. Figure 1.
Read more >Broken Links - Open Government Partnership
Broken Links: Open Data to Advance Accountability and Combat Corruption offers an overview of the state of open data against political corruption in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll take a look at it, won’t be able to work on it though til next week
@alexts0 @simonlovesyou can you help?