question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken schema since v0.91

See original GitHub issue

The 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
simonlovesyoucommented, Jun 2, 2021

I’ll take a look at it, won’t be able to work on it though til next week

1reaction
domoritzcommented, May 24, 2021

@alexts0 @simonlovesyou can you help?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found