All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.zenwave360.generator.plugins.OpenAPIToJDLGenerator.JDLToOpenAPI.yml.hbs Maven / Gradle / Ivy

openapi: 3.0.1
info:
  title: Zenwave 360 Generated API
  version: 0.0.1
servers:
  - url: http://localhost:8080/api/
tags:
  - name: "Default"
{{~#each jdlModel.serviceNames as |serviceName|}}
  - name: "{{asTagName serviceName}}"
{{~/each}}

paths:
{{~#each jdlModel.entities as |entity|}}
  {{~#unless (skipOperations entity)}}
{{~#if entity.options.searchCriteria}}
  /{{entity.kebabCasePlural}}/search:
    post:
      summary: Search {{entity.classNamePlural}}
      operationId: search{{entity.classNamePlural}}
      tags: [{{asTagName entity.options.service}}]
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/sort'
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/{{entity.options.searchCriteria}}"
      responses:
        "200":
          description: {{entity.classNamePlural}}
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{{entity.className}}Paginated"
{{~/if}}
  /{{entity.kebabCasePlural}}:
    get:
      summary: Find {{entity.classNamePlural}}
      operationId: list{{entity.classNamePlural}}
      tags: [{{asTagName entity.options.service}}]
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/sort'
      responses:
        "200":
          description: {{entity.classNamePlural}}
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{{entity.className}}Paginated"
    post:
      summary: Create {{entity.className}}
      operationId: create{{entity.className}}
      tags: [{{asTagName entity.options.service}}]
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/{{entity.className}}"
      responses:
        "201":
          description: {{entity.className}}
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{{entity.className}}"

  /{{entity.kebabCasePlural}}/{id}:
    parameters:
    - name: id
      in: path
      description: {{entity.className}} id
      required: true
      schema:
        type: {{idType}}
        {{~#if idTypeFormat}}
        format: {{idTypeFormat}}
        {{~/if}}
    get:
      summary: Get {{entity.className}} by id
      operationId: get{{entity.className}}
      tags: [{{asTagName entity.options.service}}]
      responses:
        "200":
          description: {{entity.className}}
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{{entity.className}}"
    put:
      summary: Update {{entity.className}}
      operationId: update{{entity.className}}
      tags: [{{asTagName entity.options.service}}]
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/{{entity.className}}"
      responses:
        "200":
          description: {{entity.className}}
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/{{entity.className}}"
    delete:
      summary: Delete {{entity.className}}
      operationId: delete{{entity.className}}
      tags: [{{asTagName entity.options.service}}]
      responses:
        "204":
          description: {{entity.className}} deleted
  {{/unless}}
{{/each~}}

{{{schemasAsString}}}
    Page:
      type: object
      required:
        - "content"
        - "totalElements"
        - "totalPages"
        - "size"
        - "number"
      properties:
        number:
          type: integer
          minimum: 0
        numberOfElements:
          type: integer
          minimum: 0
        size:
          type: integer
          minimum: 0
          maximum: 200
          multipleOf: 25
        totalElements:
          type: integer
        totalPages:
          type: integer

  parameters:
    page:
      name: page
      in: query
      description: The number of results page
      schema:
        type: integer
        format: int32
        default: 0
    limit:
      name: limit
      in: query
      description: The number of results in a single page
      schema:
        type: integer
        format: int32
        default: 20
    sort:
      name: sort
      in: query
      description: The number of results page
      schema:
        type: array
        items:
          type: string




© 2015 - 2025 Weber Informatics LLC | Privacy Policy