swagger-api / swagger-api/swagger-codegen

Mismatch in criteria for endpoints grouping for spring and typescript-angular

Open
#9,270 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hi,

I have the following swagger yaml.

When I'm generating the backend code, it makes only one controller. Which I think is on the basis of first part of URI i.e. "inbound". PFB the screenshot.
spring-swagger

But, while generating the frontend code, it makes two services, based upon the tags that I have defined and the code for path is in the file with the tag name.
typescript-swagger

Why is that? This is not the same logical grouping of endpoints that I'd like to see in my code. I think this needs to be re-looked or fixed.

Swagger-codegen version

Downloading from the web (https://editor2.swagger.io)

Swagger declaration file content or url
openapi: 3.0.0
info:
  title: Yard Management System
  description: Rest endpoints description of YMS.
  version: 0.1.9
servers:
  - url: http://localhost:4200
    description: Inbound Container Management module API description.
tags:
  - name: MyNewTag
    description: My new tag desc.
  - name: Inbound
    description: Operations related to the Organization.

paths:
  /inbound/container/search:
    post:
      tags:
      - MyNewTag
      security:
        - Bearer: []
      operationId: searchInBound
      summary: Search Inbound Containers.
      description: 1. From Date should be less than to Date.
                   2. Difference between From and To Date should not be     greater than 3 months.
                   3. Search Button should be disabled when no search       criteria is filled.
                   4. Container format Check(Length should be 11, 4         alphabets followed by 7digits).
      responses:
        '200':
         description: Records Found
         content:
          application/body:
              schema:
                items:
                  $ref: '#/components/schemas/InBoundDAOData'
                  
  /inbound/container/addUpdate:
    post:
      tags:
         - Inbound
      security:
         - Bearer: []
      operationId: addUpdateInBound
      summary: Add, Update and Delete
      description: Receiving process for all containers, add/update/delete container and RFID tag to the container.
      
      responses:
       '200':
        description: Added/Updated Successfully
        content:
          application/body:
              schema:
                 items:
                    $ref: '#/components/schemas/InBoundDAOData'
components:
  schemas:
    InBoundDAOData:
       type: object
       properties:
          containerNum:
           type: string
          userId:
           type: string
          status:
           type: string
          yardId:
           type: string
          offset:  
            type: string
          limit :
             type: integer
          sortType:
             type: string
          sortColumn:
              type: string  
          customerCode:
            type: integer
Command line used for generation
Steps to reproduce

Paste the swagger yaml into editor and generate the spring and typescript-angular code.

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 by reproducing the supplied OpenAPI 3 YAML in the Swagger editor, generating both Spring and typescript-angular outputs, and comparing how the two generators group the endpoints. Trace the relevant Spring and typescript-angular generator entry points to identify where grouping is selected; done means both outputs follow the intended logical grouping consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, openapi, spring, typescript
Domain
backend, frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.