swagger-api / swagger-api/swagger-parser

io.swagger.models.parameters.AbstractSerializableParameter.getType() returns "number" instead of "integer"

Open
#582 4 comments 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

The method io.swagger.models.parameters.AbstractSerializableParameter.getType() returns "number" instead of "integer":

import java.io.File;

import org.junit.Assert;
import org.junit.Test;

import io.swagger.models.Operation;
import io.swagger.models.Path;
import io.swagger.models.Swagger;
import io.swagger.models.parameters.QueryParameter;
import io.swagger.parser.SwaggerParser;

public class SwaggerParserTest {

    private void check(final Swagger swagger) {
        final Path path = swagger.getPath("/serviceV3");
        final Operation post = path.getPost();
        final QueryParameter parameter = (QueryParameter) post.getParameters().get(2);
        Assert.assertEquals("documentType", parameter.getName());
        Assert.assertEquals("int32", parameter.getFormat());
        Assert.assertEquals("integer", parameter.getType());
    }

    @Test
    public void testMissingNumberTypeLatest() {
        check(new SwaggerParser().read("https://raw.githubusercontent.com/APIs-guru/openapi-directory/master/APIs/afterbanks.com/3.0.0/swagger.yaml"));
    }
}

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 io.swagger.models.parameters.AbstractSerializableParameter.getType() and the SwaggerParserTest reproduction shown in the issue. Run the test against the referenced afterbanks.com Swagger document, then verify that the documentType parameter reports format int32 and type integer as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.