swagger-api / swagger-api/swagger-parser

missing type property is improperly ignored without much warning

Open
#441 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

A Schema Object without a type key seems to just get dropped. The spec has little clarification for a case like this but I believe it is valid. This should either but clarified and made an error or the parser should handle this more gracefully recording that the attribute exists but for example has a default type (like object or something). It's also possible the warning should just be more specific.

example case.

swagger: '2.0'

info:
  title: example
  version: "0"

paths: {}

definitions:
  aDef:
    type: object
    properties:
      initialValue:
        description: "I'm invisible!"

cross post of
https://github.com/swagger-api/swagger-codegen/issues/5335
related:
https://github.com/swagger-api/swagger-codegen/issues/5164

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Swagger 2.0 example in the issue and trace how the parser handles the Schema Object under definitions.aDef.properties.initialValue when type is absent. Review the linked swagger-codegen issues 5335 and 5164 for context and determine whether the expected result is an error, a warning, or preserving the attribute with a default type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.