swagger-api / swagger-api/swagger-parser
Number type MultipleOf fields are not being parsed and are always null
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 867
- Forks
- 560
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
The "multipleOf" fields for number types are not being parsed, they always seem to be null have attached a Scala unit test to replicate:
import io.swagger.v3.parser.OpenAPIV3Parser
import io.swagger.v3.parser.core.models.ParseOptions
class MultipleOfTest {
"multiple of" should "be not null" in
{
val openApiDef =
"""openapi: 3.0.0
|info:
| version: 0.0.0
| title: "test"
|components:
| schemas:
| AssessCandidate:
| type: object
| properties:
| candidate:
| type: object
| properties:
| id:
| type: string
| required:
| - id
| test_results:
| type: object
| properties:
| id:
| type: string
| status:
| type: string
| score:
| type: number
| multipleOf: 1
| date:
| type: string
| format: date
| comment:
| type: string
| result_url:
| type: string
| required:
| - candidate
| - test_results
|""".stripMargin
val multipleOf = new OpenAPIV3Parser().readContents(openApiDef, null, new ParseOptions).getOpenAPI.getComponents.getSchemas.get("AssessCandidate").getProperties.get("score").getMultipleOf
assert(multipleOf != null)
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the OpenAPIV3Parser.readContents entry point and the Scala unit test shown in the issue, using the supplied OpenAPI definition with a numeric multipleOf value. Confirm that the parsed score schema returns a non-null getMultipleOf value, and preserve coverage for this case in the parser tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, scala
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100