Skip to content

Commit bc29c8d

Browse files
committed
document removal of parameter (#327)
1 parent 3872e99 commit bc29c8d

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

docs/modules/ROOT/pages/mapping/parameter.adoc

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,66 @@ map:
122122
----
123123

124124
This will add a parameter `request` to the endpoint method.
125+
126+
== unnecessary parameter
127+
128+
It may also be useful to remove a parameter, maybe it is handled by a request filter and is not needed by the endpoint method.
129+
130+
Again, even if it is possible to add it at the global level, it is best used at the endpoint level.
131+
132+
[source,yaml]
133+
----
134+
openapi-processor-mapping: v12
135+
136+
options:
137+
package-name: generated
138+
139+
map:
140+
paths:
141+
/foo:
142+
parameters:
143+
- drop: foo
144+
----
145+
146+
Given the configuration above and the following endpoint description:
147+
148+
[source,yaml]
149+
----
150+
openapi: 3.1.0
151+
info:
152+
title: test unnecessary endpoint parameter
153+
version: 1.0.0
154+
155+
paths:
156+
/foo:
157+
get:
158+
parameters:
159+
- name: foo
160+
description: query, required
161+
in: query
162+
required: true
163+
schema:
164+
type: string
165+
responses:
166+
'204':
167+
description: empty
168+
----
169+
170+
the processor will generate the endpoint method without the `foo` parameter.
171+
172+
[source,java]
173+
----
174+
package generated.api;
175+
176+
import annotation.Mapping;
177+
import generated.support.Generated;
178+
179+
@Generated(value = "openapi-processor-core", version = "test")
180+
public interface Api {
181+
182+
@Mapping("/foo")
183+
void getFoo();
184+
185+
}
186+
187+
----

0 commit comments

Comments
 (0)