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 without type array is ignoring items in Responses

See original GitHub issue

Hi Team,

Please find below the swagger content in which for a response of the operation, the schema is set as items but without type array. The parser doesn’t throw any error here but the response model that is generated has ignored the items. Please correct this.

swagger: '2.0'
info:
  description: 'This is a TEST.'
  version: 1.0.0
  title: Test
host: www.abc.com
basePath: /api
schemes:
  - http
paths:
  /test:
    get:
      summary: Test
      description: 'test'
      operationId: test
      responses:
        '200':
          schema:
            items:
              $ref: '#/definitions/myResponse'
          description: myResponse
definitions:
  myResponse:
    type: object
    properties:
      id:
        type: integer
        format: `int64'

Thanks, Sree

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SCSreekanthcommented, Feb 21, 2022

Thank you @gracekarina i’ll give it a try and let you know. Thanks for the quick turnaround on the issue. Much appreciated!! Cheers

  • Sree
1reaction
gracekarinacommented, Feb 21, 2022

Hi @SCSreekanth parser was release last week, this fix is include in the last version 1.0.57 Swagger-parser 1.0.57 released!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Json schema for array of objects doesn't validate
I think the schema is validated against the array and the objects in the array are not validated. ... Its very unclear what...
Read more >
Schema validation ignoring array sub-fields type - Help
I mocked out the response body from the question and this seems to be working (failing the test due to the wrong data...
Read more >
array — Understanding JSON Schema 2020-12 documentation
It works the same as items , only the name has changed. In Draft 6 - 2019-09, the additionalItems keyword is ignored if...
Read more >
Array schema in a response has no maximum number of items ...
Description. An array schema does not specify the maximum number of items it can contain. For more details, see the OpenAPI Specification.
Read more >
Schema does not enforce requirement of array items object
Upstream Swagger schema allows array properties without items property ... a numeric type, the effect is that the minLength is just ignored.
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