Skip to content

State of the 3.0.0_enhancements branch #7140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mricken opened this issue Dec 8, 2017 · 2 comments
Closed

State of the 3.0.0_enhancements branch #7140

mricken opened this issue Dec 8, 2017 · 2 comments

Comments

@mricken
Copy link

mricken commented Dec 8, 2017

I'm trying to evaluate what my team needs to do to move from specs written in Swagger 2 to specs written in OpenAPI 3. To do that, I'm taking a look at the 3.0.0_enhancements branch.

Unfortunately, the branch does not build for me:

$ git status
On branch 3.0.0_enhancements
Your branch is up-to-date with 'origin/3.0.0_enhancements'.
nothing to commit, working tree clean
$ mvn clean install
...
[INFO] Reactor Summary:
[INFO]
[INFO] swagger-codegen-project ............................ SUCCESS [  8.357 s]
[INFO] swagger-codegen (core library) ..................... FAILURE [02:03 min]
[INFO] swagger-codegen (executable) ....................... SKIPPED
[INFO] swagger-codegen (maven-plugin) ..................... SKIPPED
[INFO] swagger-generator .................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Judging by the checks done on commit, the branch stopped building successfully after November 22:
https://github.com/swagger-api/swagger-codegen/commits/3.0.0_enhancements

Things I'm trying to find out are:

  1. Can the Swagger 3 parser load Swagger 2 specs?
  2. How do discriminators and polymorphism work in Swagger 3? How do we need to change our specs for that to work? Does OpenAPI 3 support a "default" subclass if there is no discriminator?
  3. and other things.

It would be very helpful if I could actually build and experiment with this code.

Now, since @HugoMario is continuing to check things in, there must be a reasonable separation between what should work and what shouldn't.

Can you please explain how you work with this branch, even though a top-level build doesn't succeed? Do I just ignore failing unit tests?

Failed tests:
  CodegenTest.fileUploadParamTest:66 » NullPointer
  DefaultGeneratorTest.testGenerateUniqueOperationIds:273 » Runtime Could not pr...
...
Tests run: 484, Failures: 126, Errors: 0, Skipped: 3

Thanks!

--Mathias

@mricken
Copy link
Author

mricken commented Dec 12, 2017

I ignored a whole bunch of unit test failures and removed all of swagger-generator and was able to build most of it.
However, even simple specs fail to generate. I tracked this down to an NPE in reusable parameters.

	at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:1903)
	at io.swagger.codegen.languages.AbstractJavaCodegen.fromOperation(AbstractJavaCodegen.java:1051)
	at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:873)
	at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:800)
	at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:414)
	at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:732)
	at io.swagger.codegen.cmd.Generate.run(Generate.java:308)
	at java.lang.Thread.run(Thread.java:745)
Exception in thread "Thread-1" java.lang.RuntimeException: Could not process operation:
  Tag: class Tag {
    name: pets
    description: null
    externalDocs: null
}
  Operation: showPetById
  Resource: get /pets/{petId}
  Exception: null
	at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:900)
	at io.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:800)
	at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:414)
	at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:732)
	at io.swagger.codegen.cmd.Generate.run(Generate.java:308)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at io.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:1903)
	at io.swagger.codegen.languages.AbstractJavaCodegen.fromOperation(AbstractJavaCodegen.java:1051)
	at io.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:873)
	... 5 more

as soon as I have a $ref for a parameter:

    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
        - $ref: '#/components/parameters/MyQueryParam'
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
# ...
  parameters:
    MyQueryParam:
      in: query
      name: qp
      required: true
      schema:
        type: string
        minLength: 1
        maxLength: 255```

Should I open these as separate issues for the 3.0.0_enhancements branch, or are they known issues?

@HugoMario
Copy link
Contributor

Hey @mricken , sorry for delay response.

Right now, we're working focus on #6041 and #6077 , about failure build, the most common reason is because there are swagger 2.0 that still have not been removed, specially on swagger-generator module.

About if openApi 3.0 is going to support swagger 2.0, the answer is yes. We're going to use a converter for that.

There is an estimate date Jan 8 2018 for a beta release. We're going to start with java client and server.

About the issue you get, please, file the issue and i'll look on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants