Open springwiz opened 4 years ago
What are you expecting the sysl to look like? is it just the nameing of the objects or something else?
Sysl should create wrapper types wherever possible. So lets say:
/rest?method=flickr%2Efavorites%2EgetContext:
GET ?api_key=string&photo_id=string&user_id=string?:
| Returns next and previous favorites for a photo in a user's
| favorites
return ok <: PhotoResource
!type PhotoResource:
count <: object_object_count?:
@json_tag = "count"
nextphoto <: ContextPhoto?:
@json_tag = "nextphoto"
prevphoto <: ContextPhoto?:
@json_tag = "prevphoto"
stat <: Stat?:
@json_tag = "stat"
so yes, its just the name you dont like. Where is it supposed to get the wrapper name from? It already tries to give it a sensible name.
So no not just the name, it has to use some kind of intelligent naming as the same scenario can repeat for multiple operations on an endpoint. The sysl ends up with multiple types named as "object" which results in invalid sysl.
The long term solution is to extend to Sysl return syntax thus:
/rest?method=flickr%2Efavorites%2EgetContext:
GET ?api_key=string&photo_id=string&user_id=string?:
| Returns next and previous favorites for a photo in a user's
| favorites
return ok <:
count <: object_object_count?:
@json_tag = "count"
nextphoto <: ContextPhoto?:
@json_tag = "nextphoto"
prevphoto <: ContextPhoto?:
@json_tag = "prevphoto"
stat <: Stat?:
@json_tag = "stat"
Please do not post any internal, closed source snippets on this public issue tracker!
Current Sysl Version
0.136.0
Use-cases
Please describe the end goal you are trying to achieve that has led you to request this feature. Explore the possibility of creating wrapper response types automatically in the generated sysl when the incoming swagger uses generic response object types without any schema. This will allow the codegen to work from the generated sysl without the need of manual modification in the swagger/sysl.
For instance the incoming swagger fragment:
Generates:
The importer ends up generating a lot of such generic object types which makes codegen impossible. Make the solution configurable on the command line.
Attempted Solutions
Manual modification of the incoming swagger/sysl looks as the only solution.
References
2020