better mapping format
hauner opened this issue · 3 comments
hauner commented
the mapping uses multiple pairs of keywords to define the the different mappings:
types:
- from: ..
to: ..
parameters:
- name: ..
to: ..
- add: ..
as: ..
responses:
- content: ..
to: ...
This is getting confusing. Looking for a better idea to handle the different cases with less keywords.
hauner commented
maybe use source/target
or in/out
to reuse the same keywords. That doesn't work for the add parameter case. Hmm.
hauner commented
spring boot gateway configuration uses something like this:
predicates:
- Path=/**
or
predicates:
- name: Cookie
args:
name: mycookie
regexp: mycookievalue
hauner commented
considering something like this:
map:
# single wrapper, maybe without the "=>"
single: => <to>
# multi wrapper
multi: => <to>
# result wrapper
result: => <to>
# list of global mappings
types:
# standard type mapping
- type: <from> => <to>
- type: <from2> => <to2>
# list of global parameter mappings
parameters:
# map by parameter name
- name: <name> => <to>
# add parameter
- add: <name> => <to>
# map by content type
responses:
- content: <content> => <to>
- Less keywords to remember, just the mapping operator
=>
. - more parsing (?)
a few examples:
map:
result: org.springframework.http.ResponseEntity
types:
- type: Pageable => org.springframework.data.domain.Pageable
parameters:
- name: pageable => org.springframework.data.domain.Pageable
- add: request => javax.servlet.http.HttpServletRequest
responses:
- content: application/json => org.springframework.data.domain.Page<java.lang.String>