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.

"should be an array" error caused by misspelled "type" values

See original GitHub issue

Q&A (please complete the following information)

  • OS: Windows 7
  • Browser: Chrome 67
  • Method of installation: http://editor.swagger.io
  • Swagger-Editor version: 3.6.3
  • Swagger/OpenAPI version: 2.0

Example Swagger/OpenAPI definition:

swagger: '2.0'
info:
  title: test
  version: 0.0.0
paths: {}

definitions:
  Model1:
    type: int

Describe the bug you’re encountering

A misspelled type value triggers an odd error

should be array

Expected behavior

No “should be array” error.

Screenshots

image

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
webroncommented, Apr 16, 2019

null is not supported. The validation JSON Schema is not the source of truth. No null.

0reactions
hkosovacommented, Apr 16, 2019

Interesting… The official OAS2 schema imports the Schema.type definition from the JSON Schema schema

        "type": {
          "$ref": "http://json-schema.org/draft-04/schema#/properties/type"
        },

and the JSON Schema schema uses

    "definitions": {
        ...
        "simpleTypes": {
            "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
        },
        ...
        "type": {
            "anyOf": [
                { "$ref": "#/definitions/simpleTypes" },
                ...
            ]
        },

meaning the OAS2 schema does indeed (sort of) allow type: null.

Which might be an oversight of the part of OAS spec authors because other places in the OAS2 schema (e.g. queryParameterSubSchema.type) list the possible type values explicitly and there’s no null type there.

@webron could you please clarify this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

I keep getting error on must be array type but it resolved to string
I got some errors on length cannot be resolved or not part of a field the type of the expression must be an...
Read more >
Error Comprehension and Debugging - Pre-Lab Content
Another common indexing error occurs when you attempt to use an index that is larger than the number of elements in the array....
Read more >
How to Prevent the Error: Cannot Read Property '0' of Undefined
If a property of an object is an array, it's possible to accidentally misspell the key or try to access the array through...
Read more >
Syntax Error - an overview | ScienceDirect Topics
6.5.​​ Syntax errors are mistakes in using the language. Examples of syntax errors are missing a comma or a quotation mark, or misspelling...
Read more >
Common error messages in NCL
The type of missing value could not be converted to type of variable. Sample code that causes the error: x = (/1,2,3,4,5,-999/) ;...
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