Code Monkey home page Code Monkey logo

Comments (2)

sharmasourabh avatar sharmasourabh commented on July 21, 2024

Any workaround to resolve it?

from gradle-swagger-generator-plugin.

AlexGustafsson avatar AlexGustafsson commented on July 21, 2024

This seems stale to say the least, but for people coming here from Google, I took the direction of combining multiple files to one before using this plugin.

I opened an issue to suggest the implementation of a $include field which would allow for arbitrary includes of other YAML files.

For now, the workaround I use is an added task to compile the YAML files before using the plugin:

task compileSwaggerSchema(type: Exec) {
  inputs.files 'api.yml', 'index.yml', 'models.yml'
  outputs.file 'documentation/api/schemas/v1/schema.yml'
  workingDir 'documentation/api/schemas/v1'
  commandLine 'bash', '-c', 'npx swagger-cli bundle --outfile schema.yml --type yaml index.yml'
}
generateSwaggerUI.dependsOn compileSwaggerSchema

Example index.yml:

openapi: 3.0.0
paths:
  $ref: "./api.yml"
components:
  schemas:
    $ref: "./models.yml"
# api.yml
/:
  get:
    responses:
      '200':
        description: The authentication process was started successfully.
        content:
          application/json:
            schema:
              $ref: './models.yml#/Response'
     
# models.yml
Response:
  type: object
  properties:
    foo:
      type: string

The workaround requires node and npm. It uses https://github.com/APIDevTools/swagger-cli.

from gradle-swagger-generator-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.