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.

Schema for object with number index

See original GitHub issue

The typescript type

interface MyType {
  [index: number]: number
}

is parsed into the schema

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "items": {
        "type": "number"
    },
    "type": "array"
}

while it should be parsed into

{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "patternProperties": {
        "^[0-9]+$": {
            "type": "number"
        }
    },
    "additionalProperties": false
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
domoritzcommented, Sep 19, 2018

It looks incorrect to me. If we don’t have a test for it, probably no.

0reactions
CaselITcommented, Oct 29, 2018

I’ve found the time to look into fixing this. I’ve added a pull request that fixes this

Read more comments on GitHub >

github_iconTop Results From Across the Web

10 Schema Objects - Oracle Help Center
A schema is a collection of schema objects. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database links, snapshots, procedures ...
Read more >
How to define object in array in Mongoose schema correctly ...
For making an array in schema we have to make one more schema as ... blk_data is a transaction list (block number and...
Read more >
Mongoose v6.8.1: SchemaTypes
You can think of a Mongoose schema as the configuration object for a Mongoose model. ... String; Number; Date; Buffer; Boolean; Mixed; ObjectId;...
Read more >
List of objects with required values · Discussion #191 - GitHub
How do you define required values in a list? I have a list of objects with a property which is an enum with...
Read more >
Add an Index to a Big Object - Salesforce Help
The index defines the composite primary key for a custom big object and is used for querying and filtering the big object data....
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