Skip to content

Generating servercode from http://editor.swagger.io differs from http://generator.swagger.io #5315

@albert-visser

Description

@albert-visser
Description

I'm getting different generated servercode from http://editor.swagger.io and http://generator.swagger.io
The first will generate classes that inherit when using allOf, http://generator.swagger.io won't.

Swagger-codegen version

2.2.2

Swagger declaration file content or url

https://gist.github.com/albert-visser/498345f062b64026941d0c7c3d81d7ac

Steps to reproduce

Using http://editor.swagger.io

  1. Goto http://editor.swagger.io
  2. File --> import json --> content of gist
  3. Generate server -> aspnetcore or spring

Result: zip file with an event class
Spring: public class Event extends EventPost {
Aspnetcore: public partial class Event : EventPost, IEquatable<Event>

Using http://generator.swagger.io

  1. Goto http://generator.swagger.io
  2. Server --> Post --> aspnetcore or spring with following
{
  "spec": {},
  "options": {},
  "swaggerUrl": "https://gist.githubusercontent.com/albert-visser/e3340fa6f03a929441b6d65f424924c7/raw/dc6a0443aa9f453088f2c69365a3ad60b1681dd7/swagger"
}
  1. Download zipfile
    Result: zip file with an event class
    Spring: public class Event {
    Aspnetcore: public partial class Event : IEquatable<Event>

This is wrong, classes from http://generator.swagger.io should inherit EventPost.

Using swagger-codegen-cli-2.2.2

  1. Using the cli the result is same as http://generator.swagger.io
    java -jar swagger-codegen-cli-2.2.2.jar generate -i https://gist.githubusercontent.com/albert-visser/e3340fa6f03a929441b6d65f424924c7/raw/dc6a0443aa9f453088f2c69365a3ad60b1681dd7/swagger -l aspnetcore -o .\output

Result: Same as http://generator.swagger.io

Related issues

#2096
#3544

Suggest a Fix

I've checked what http://editor.swagger.io is doing different, it is actually using http://generator.swagger.io for generation. But instead of posting a link it will include swagger in the body.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions