Skip to content

Commit d0b98d2

Browse files
feat: [OpenAPI] Add toMap() and deprecate getCustomField(String) (#723)
1 parent c6756ff commit d0b98d2

File tree

54 files changed

+1000
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1000
-1
lines changed

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AllOf.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,15 @@ public Set<String> getCustomFieldNames()
218218
/**
219219
* Get the value of an unrecognizable property of this {@link AllOf} instance.
220220
*
221+
* @deprecated Use {@link #toMap()} instead.
221222
* @param name
222223
* The name of the property
223224
* @return The value of the property
224225
* @throws NoSuchElementException
225226
* If no property with the given name could be found.
226227
*/
227228
@Nullable
229+
@Deprecated
228230
public Object getCustomField( @Nonnull final String name )
229231
throws NoSuchElementException
230232
{
@@ -234,6 +236,27 @@ public Object getCustomField( @Nonnull final String name )
234236
return cloudSdkCustomFields.get(name);
235237
}
236238

239+
/**
240+
* Get the value of all properties of this {@link AllOf} instance including unrecognized properties.
241+
*
242+
* @return The map of all properties
243+
*/
244+
@JsonIgnore
245+
@Nonnull
246+
public Map<String, Object> toMap()
247+
{
248+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
249+
if( sodaType != null )
250+
declaredFields.put("sodaType", sodaType);
251+
if( caffeine != null )
252+
declaredFields.put("caffeine", caffeine);
253+
if( color != null )
254+
declaredFields.put("color", color);
255+
if( flavor != null )
256+
declaredFields.put("flavor", flavor);
257+
return declaredFields;
258+
}
259+
237260
/**
238261
* Set an unrecognizable property of this {@link AllOf} instance. If the map previously contained a mapping for the
239262
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/AnyOf.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,15 @@ public Set<String> getCustomFieldNames()
218218
/**
219219
* Get the value of an unrecognizable property of this {@link AnyOf} instance.
220220
*
221+
* @deprecated Use {@link #toMap()} instead.
221222
* @param name
222223
* The name of the property
223224
* @return The value of the property
224225
* @throws NoSuchElementException
225226
* If no property with the given name could be found.
226227
*/
227228
@Nullable
229+
@Deprecated
228230
public Object getCustomField( @Nonnull final String name )
229231
throws NoSuchElementException
230232
{
@@ -234,6 +236,27 @@ public Object getCustomField( @Nonnull final String name )
234236
return cloudSdkCustomFields.get(name);
235237
}
236238

239+
/**
240+
* Get the value of all properties of this {@link AnyOf} instance including unrecognized properties.
241+
*
242+
* @return The map of all properties
243+
*/
244+
@JsonIgnore
245+
@Nonnull
246+
public Map<String, Object> toMap()
247+
{
248+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
249+
if( sodaType != null )
250+
declaredFields.put("sodaType", sodaType);
251+
if( caffeine != null )
252+
declaredFields.put("caffeine", caffeine);
253+
if( color != null )
254+
declaredFields.put("color", color);
255+
if( flavor != null )
256+
declaredFields.put("flavor", flavor);
257+
return declaredFields;
258+
}
259+
237260
/**
238261
* Set an unrecognizable property of this {@link AnyOf} instance. If the map previously contained a mapping for the
239262
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Bar.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ public Set<String> getCustomFieldNames()
208208
/**
209209
* Get the value of an unrecognizable property of this {@link Bar} instance.
210210
*
211+
* @deprecated Use {@link #toMap()} instead.
211212
* @param name
212213
* The name of the property
213214
* @return The value of the property
214215
* @throws NoSuchElementException
215216
* If no property with the given name could be found.
216217
*/
217218
@Nullable
219+
@Deprecated
218220
public Object getCustomField( @Nonnull final String name )
219221
throws NoSuchElementException
220222
{
@@ -224,6 +226,23 @@ public Object getCustomField( @Nonnull final String name )
224226
return cloudSdkCustomFields.get(name);
225227
}
226228

229+
/**
230+
* Get the value of all properties of this {@link Bar} instance including unrecognized properties.
231+
*
232+
* @return The map of all properties
233+
*/
234+
@JsonIgnore
235+
@Nonnull
236+
public Map<String, Object> toMap()
237+
{
238+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
239+
if( bar != null )
240+
declaredFields.put("bar", bar);
241+
if( disc != null )
242+
declaredFields.put("disc", disc);
243+
return declaredFields;
244+
}
245+
227246
/**
228247
* Set an unrecognizable property of this {@link Bar} instance. If the map previously contained a mapping for the
229248
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Cola.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,15 @@ public Set<String> getCustomFieldNames()
140140
/**
141141
* Get the value of an unrecognizable property of this {@link Cola} instance.
142142
*
143+
* @deprecated Use {@link #toMap()} instead.
143144
* @param name
144145
* The name of the property
145146
* @return The value of the property
146147
* @throws NoSuchElementException
147148
* If no property with the given name could be found.
148149
*/
149150
@Nullable
151+
@Deprecated
150152
public Object getCustomField( @Nonnull final String name )
151153
throws NoSuchElementException
152154
{
@@ -156,6 +158,23 @@ public Object getCustomField( @Nonnull final String name )
156158
return cloudSdkCustomFields.get(name);
157159
}
158160

161+
/**
162+
* Get the value of all properties of this {@link Cola} instance including unrecognized properties.
163+
*
164+
* @return The map of all properties
165+
*/
166+
@JsonIgnore
167+
@Nonnull
168+
public Map<String, Object> toMap()
169+
{
170+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
171+
if( sodaType != null )
172+
declaredFields.put("sodaType", sodaType);
173+
if( caffeine != null )
174+
declaredFields.put("caffeine", caffeine);
175+
return declaredFields;
176+
}
177+
159178
/**
160179
* Set an unrecognizable property of this {@link Cola} instance. If the map previously contained a mapping for the
161180
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Fanta.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,15 @@ public Set<String> getCustomFieldNames()
179179
/**
180180
* Get the value of an unrecognizable property of this {@link Fanta} instance.
181181
*
182+
* @deprecated Use {@link #toMap()} instead.
182183
* @param name
183184
* The name of the property
184185
* @return The value of the property
185186
* @throws NoSuchElementException
186187
* If no property with the given name could be found.
187188
*/
188189
@Nullable
190+
@Deprecated
189191
public Object getCustomField( @Nonnull final String name )
190192
throws NoSuchElementException
191193
{
@@ -195,6 +197,25 @@ public Object getCustomField( @Nonnull final String name )
195197
return cloudSdkCustomFields.get(name);
196198
}
197199

200+
/**
201+
* Get the value of all properties of this {@link Fanta} instance including unrecognized properties.
202+
*
203+
* @return The map of all properties
204+
*/
205+
@JsonIgnore
206+
@Nonnull
207+
public Map<String, Object> toMap()
208+
{
209+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
210+
if( sodaType != null )
211+
declaredFields.put("sodaType", sodaType);
212+
if( color != null )
213+
declaredFields.put("color", color);
214+
if( flavor != null )
215+
declaredFields.put("flavor", flavor);
216+
return declaredFields;
217+
}
218+
198219
/**
199220
* Set an unrecognizable property of this {@link Fanta} instance. If the map previously contained a mapping for the
200221
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/FantaFlavorOneOf.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,15 @@ public Set<String> getCustomFieldNames()
140140
/**
141141
* Get the value of an unrecognizable property of this {@link FantaFlavorOneOf} instance.
142142
*
143+
* @deprecated Use {@link #toMap()} instead.
143144
* @param name
144145
* The name of the property
145146
* @return The value of the property
146147
* @throws NoSuchElementException
147148
* If no property with the given name could be found.
148149
*/
149150
@Nullable
151+
@Deprecated
150152
public Object getCustomField( @Nonnull final String name )
151153
throws NoSuchElementException
152154
{
@@ -156,6 +158,23 @@ public Object getCustomField( @Nonnull final String name )
156158
return cloudSdkCustomFields.get(name);
157159
}
158160

161+
/**
162+
* Get the value of all properties of this {@link FantaFlavorOneOf} instance including unrecognized properties.
163+
*
164+
* @return The map of all properties
165+
*/
166+
@JsonIgnore
167+
@Nonnull
168+
public Map<String, Object> toMap()
169+
{
170+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
171+
if( intensity != null )
172+
declaredFields.put("intensity", intensity);
173+
if( nuance != null )
174+
declaredFields.put("nuance", nuance);
175+
return declaredFields;
176+
}
177+
159178
/**
160179
* Set an unrecognizable property of this {@link FantaFlavorOneOf} instance. If the map previously contained a
161180
* mapping for the key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Foo.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,15 @@ public Set<String> getCustomFieldNames()
208208
/**
209209
* Get the value of an unrecognizable property of this {@link Foo} instance.
210210
*
211+
* @deprecated Use {@link #toMap()} instead.
211212
* @param name
212213
* The name of the property
213214
* @return The value of the property
214215
* @throws NoSuchElementException
215216
* If no property with the given name could be found.
216217
*/
217218
@Nullable
219+
@Deprecated
218220
public Object getCustomField( @Nonnull final String name )
219221
throws NoSuchElementException
220222
{
@@ -224,6 +226,23 @@ public Object getCustomField( @Nonnull final String name )
224226
return cloudSdkCustomFields.get(name);
225227
}
226228

229+
/**
230+
* Get the value of all properties of this {@link Foo} instance including unrecognized properties.
231+
*
232+
* @return The map of all properties
233+
*/
234+
@JsonIgnore
235+
@Nonnull
236+
public Map<String, Object> toMap()
237+
{
238+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
239+
if( foo != null )
240+
declaredFields.put("foo", foo);
241+
if( disc != null )
242+
declaredFields.put("disc", disc);
243+
return declaredFields;
244+
}
245+
227246
/**
228247
* Set an unrecognizable property of this {@link Foo} instance. If the map previously contained a mapping for the
229248
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/Order.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,13 +257,15 @@ public Set<String> getCustomFieldNames()
257257
/**
258258
* Get the value of an unrecognizable property of this {@link Order} instance.
259259
*
260+
* @deprecated Use {@link #toMap()} instead.
260261
* @param name
261262
* The name of the property
262263
* @return The value of the property
263264
* @throws NoSuchElementException
264265
* If no property with the given name could be found.
265266
*/
266267
@Nullable
268+
@Deprecated
267269
public Object getCustomField( @Nonnull final String name )
268270
throws NoSuchElementException
269271
{
@@ -273,6 +275,29 @@ public Object getCustomField( @Nonnull final String name )
273275
return cloudSdkCustomFields.get(name);
274276
}
275277

278+
/**
279+
* Get the value of all properties of this {@link Order} instance including unrecognized properties.
280+
*
281+
* @return The map of all properties
282+
*/
283+
@JsonIgnore
284+
@Nonnull
285+
public Map<String, Object> toMap()
286+
{
287+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
288+
if( productId != null )
289+
declaredFields.put("productId", productId);
290+
if( quantity != null )
291+
declaredFields.put("quantity", quantity);
292+
if( totalPrice != null )
293+
declaredFields.put("totalPrice", totalPrice);
294+
if( typelessProperty != null )
295+
declaredFields.put("typelessProperty", typelessProperty);
296+
if( nullableProperty != null )
297+
declaredFields.put("nullableProperty", nullableProperty);
298+
return declaredFields;
299+
}
300+
276301
/**
277302
* Set an unrecognizable property of this {@link Order} instance. If the map previously contained a mapping for the
278303
* key, the old value is replaced by the specified value.

datamodel/openapi/openapi-api-sample/src/main/java/com/sap/cloud/sdk/datamodel/openapi/sample/model/OrderWithTimestamp.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,13 +297,15 @@ public Set<String> getCustomFieldNames()
297297
/**
298298
* Get the value of an unrecognizable property of this {@link OrderWithTimestamp} instance.
299299
*
300+
* @deprecated Use {@link #toMap()} instead.
300301
* @param name
301302
* The name of the property
302303
* @return The value of the property
303304
* @throws NoSuchElementException
304305
* If no property with the given name could be found.
305306
*/
306307
@Nullable
308+
@Deprecated
307309
public Object getCustomField( @Nonnull final String name )
308310
throws NoSuchElementException
309311
{
@@ -313,6 +315,31 @@ public Object getCustomField( @Nonnull final String name )
313315
return cloudSdkCustomFields.get(name);
314316
}
315317

318+
/**
319+
* Get the value of all properties of this {@link OrderWithTimestamp} instance including unrecognized properties.
320+
*
321+
* @return The map of all properties
322+
*/
323+
@JsonIgnore
324+
@Nonnull
325+
public Map<String, Object> toMap()
326+
{
327+
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
328+
if( productId != null )
329+
declaredFields.put("productId", productId);
330+
if( quantity != null )
331+
declaredFields.put("quantity", quantity);
332+
if( totalPrice != null )
333+
declaredFields.put("totalPrice", totalPrice);
334+
if( typelessProperty != null )
335+
declaredFields.put("typelessProperty", typelessProperty);
336+
if( nullableProperty != null )
337+
declaredFields.put("nullableProperty", nullableProperty);
338+
if( timestamp != null )
339+
declaredFields.put("timestamp", timestamp);
340+
return declaredFields;
341+
}
342+
316343
/**
317344
* Set an unrecognizable property of this {@link OrderWithTimestamp} instance. If the map previously contained a
318345
* mapping for the key, the old value is replaced by the specified value.

0 commit comments

Comments
 (0)