swagger-api / swagger-api/swagger-codegen

Generator for new language ABAP

Open
#7,643 19 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

I'm currently trying to create my own generator for the SAP ABAP language to consume service that use swagger. I'm able to generate my class but I'm facing some issue to declare some stuff in my generated code

Swagger-codegen version

I'm using the last version of swagger-codegen

Swagger declaration file content or url

I'm using the swagger declaration from this url https://app.mapotempo.com/api/0.1/swagger_doc

Related issues/PRs

in the declaration of the service I have the object below:

 "router_options": {
  "track": true,
  "motorway": true,
  "toll": true,
  "trailers": 0,
  "weight": 0,
  "weight_per_axle": 0,
  "height": 0,
  "width": 0,
  "length": 0,
  "hazardous_goods": "explosive",
  "max_walk_distance": 0,
  "approach": "unrestricted",
  "snap": 0,
  "strict_restriction": true
}

the output generated the code below:

i_router_options_track      type bool  optional       
i_router_options_motorway      type bool  optional       
i_router_options_toll      type bool  optional      
i_router_options_trailers      type int  optional      
i_router_options_weight      type float  optional       
i_router_options_weight_per_axle      type float  optional  
i_router_options_height      type float  optional    
i_router_options_width      type float  optional    
i_router_options_length      type float  optional   
i_router_options_hazardous_goods      type string  optional 
i_router_options_max_walk_distance      type float  optional

I would like to be able to declare nested structure like below:

types : begin of ts_router_options, 
    track              type bool,
    motorway           type bool,
    toll               type bool,
    trailers           type int,
    weight             type float,
    weight_per_axle    type float,
    height             type float,
    width              type float,
    length             type float,
    hazardous_goods    type string,
    max_walk_distance  type float,
    approach           type string,
    snap               type float,
    strict_restriction type bool,
    end of ts_router_options.

and be able to use is like below:

data : router_options type ts_router_options.
router_options-height = '10,10'

could you please provide me some input to be able to create nested structure from formdata .
thanks and regards

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 reviewing swagger-codegen's generator architecture and the templates or model-generation entry points used for nested objects. Use the supplied Swagger declaration to reproduce the flattened router_options output, then define how nested ABAP structures should be represented and verify the generated result against the requested ABAP examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.