Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit dee64f7

Browse files
committed
Sample regen, property name adjusted to prevent collision
1 parent bfb8df4 commit dee64f7

File tree

6 files changed

+44
-46
lines changed

6 files changed

+44
-46
lines changed

samples/client/petstore/java/.openapi-generator/FILES

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,8 +1699,6 @@ src/main/java/org/openapijsonschematools/client/servers/ServerWithVariables.java
16991699
src/main/java/org/openapijsonschematools/client/servers/ServerWithoutVariables.java
17001700
src/main/java/org/openapijsonschematools/client/servers/server0/Variables.java
17011701
src/main/java/org/openapijsonschematools/client/servers/server1/Variables.java
1702-
src/test/java/org/openapijsonschematools/client/components/schemas/ItemsSchemaTest.java
1703-
src/test/java/org/openapijsonschematools/client/components/schemas/MultiPropertiesSchemaTest.java
17041702
src/test/java/org/openapijsonschematools/client/configurations/JsonSchemaKeywordFlagsTest.java
17051703
src/test/java/org/openapijsonschematools/client/header/ContentHeaderTest.java
17061704
src/test/java/org/openapijsonschematools/client/header/SchemaHeaderTest.java

samples/client/petstore/java/docs/components/schemas/ItemsSchema.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ A class that contains necessary nested
2020
| sealed interface | [ItemsSchema.SecondAdditionalPropertyBoxed](#secondadditionalpropertyboxed)<br> sealed interface for validated payloads |
2121
| record | [ItemsSchema.SecondAdditionalPropertyBoxedString](#secondadditionalpropertyboxedstring)<br> boxed class to store validated String payloads |
2222
| static class | [ItemsSchema.SecondAdditionalProperty](#secondadditionalproperty)<br> schema class |
23-
| sealed interface | [ItemsSchema.AdditionalPropertyBoxed](#additionalpropertyboxed)<br> sealed interface for validated payloads |
24-
| record | [ItemsSchema.AdditionalPropertyBoxedString](#additionalpropertyboxedstring)<br> boxed class to store validated String payloads |
25-
| static class | [ItemsSchema.AdditionalProperty](#additionalproperty)<br> schema class |
23+
| sealed interface | [ItemsSchema.SomePropertyBoxed](#somepropertyboxed)<br> sealed interface for validated payloads |
24+
| record | [ItemsSchema.SomePropertyBoxedString](#somepropertyboxedstring)<br> boxed class to store validated String payloads |
25+
| static class | [ItemsSchema.SomeProperty](#someproperty)<br> schema class |
2626
| sealed interface | [ItemsSchema.NameBoxed](#nameboxed)<br> sealed interface for validated payloads |
2727
| record | [ItemsSchema.NameBoxedString](#nameboxedstring)<br> boxed class to store validated String payloads |
2828
| static class | [ItemsSchema.Name](#name)<br> schema class |
@@ -79,7 +79,7 @@ ItemsSchema.ItemsSchemaMap validatedPayload =
7979
new ItemsSchema.ItemsSchemaMapBuilder()
8080
.name("a")
8181
82-
.additionalProperty("a")
82+
.someProperty("a")
8383
8484
.secondAdditionalProperty("a")
8585
@@ -92,7 +92,7 @@ ItemsSchema.ItemsSchemaMap validatedPayload =
9292
| Modifier and Type | Field and Description |
9393
| ----------------- | ---------------------- |
9494
| Set<Class<?>> | type = Set.of(Map.class) |
95-
| Map<String, Class<? extends JsonSchema>> | properties = Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("name", [Name.class](#name))),<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("additionalProperty", [AdditionalProperty.class](#additionalproperty))),<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("secondAdditionalProperty", [SecondAdditionalProperty.class](#secondadditionalproperty)))<br>)<br> |
95+
| Map<String, Class<? extends JsonSchema>> | properties = Map.ofEntries(<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("name", [Name.class](#name))),<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("someProperty", [SomeProperty.class](#someproperty))),<br>&nbsp;&nbsp;&nbsp;&nbsp;new PropertyEntry("secondAdditionalProperty", [SecondAdditionalProperty.class](#secondadditionalproperty)))<br>)<br> |
9696

9797
### Method Summary
9898
| Modifier and Type | Method and Description |
@@ -118,7 +118,7 @@ A class that builds the Map input type
118118
| ----------------- | ---------------------- |
119119
| Map<String, @Nullable Object> | build()<br>Returns map input that should be used with Schema.validate |
120120
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | name(String value) |
121-
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String value) |
121+
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | someProperty(String value) |
122122
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | secondAdditionalProperty(String value) |
123123
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, Void value) |
124124
| [ItemsSchemaMapBuilder](#itemsschemamapbuilder) | additionalProperty(String key, boolean value) |
@@ -141,7 +141,7 @@ A class to store validated Map payloads
141141
| ----------------- | ---------------------- |
142142
| static [ItemsSchemaMap](#itemsschemamap) | of([Map<String, ? extends @Nullable Object>](#itemsschemamapbuilder) arg, SchemaConfiguration configuration) |
143143
| String | name()<br>[optional] |
144-
| String | additionalProperty()<br>[optional] |
144+
| String | someProperty()<br>[optional] |
145145
| String | secondAdditionalProperty()<br>[optional] |
146146
| @Nullable Object | getAdditionalProperty(String name)<br>provides type safety for additional properties |
147147

@@ -180,32 +180,32 @@ A schema class that validates payloads
180180
| validate |
181181
| validateAndBox |
182182

183-
## AdditionalPropertyBoxed
184-
public sealed interface AdditionalPropertyBoxed<br>
183+
## SomePropertyBoxed
184+
public sealed interface SomePropertyBoxed<br>
185185
permits<br>
186-
[AdditionalPropertyBoxedString](#additionalpropertyboxedstring)
186+
[SomePropertyBoxedString](#somepropertyboxedstring)
187187

188188
sealed interface that stores validated payloads using boxed classes
189189

190-
## AdditionalPropertyBoxedString
191-
public record AdditionalPropertyBoxedString<br>
192-
implements [AdditionalPropertyBoxed](#additionalpropertyboxed)
190+
## SomePropertyBoxedString
191+
public record SomePropertyBoxedString<br>
192+
implements [SomePropertyBoxed](#somepropertyboxed)
193193

194194
record that stores validated String payloads, sealed permits implementation
195195

196196
### Constructor Summary
197197
| Constructor and Description |
198198
| --------------------------- |
199-
| AdditionalPropertyBoxedString(String data)<br>Creates an instance, private visibility |
199+
| SomePropertyBoxedString(String data)<br>Creates an instance, private visibility |
200200

201201
### Method Summary
202202
| Modifier and Type | Method and Description |
203203
| ----------------- | ---------------------- |
204204
| String | data()<br>validated payload |
205205
| @Nullable Object | getData()<br>validated payload |
206206

207-
## AdditionalProperty
208-
public static class AdditionalProperty<br>
207+
## SomeProperty
208+
public static class SomeProperty<br>
209209
extends StringJsonSchema.StringJsonSchema1
210210

211211
A schema class that validates payloads

samples/client/petstore/java/src/main/java/org/openapijsonschematools/client/components/schemas/ItemsSchema.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public static Name getInstance() {
3939
}
4040

4141

42-
public static class AdditionalProperty extends StringJsonSchema.StringJsonSchema1 {
43-
private static @Nullable AdditionalProperty instance = null;
44-
public static AdditionalProperty getInstance() {
42+
public static class SomeProperty extends StringJsonSchema.StringJsonSchema1 {
43+
private static @Nullable SomeProperty instance = null;
44+
public static SomeProperty getInstance() {
4545
if (instance == null) {
46-
instance = new AdditionalProperty();
46+
instance = new SomeProperty();
4747
}
4848
return instance;
4949
}
@@ -68,7 +68,7 @@ protected ItemsSchemaMap(FrozenMap<@Nullable Object> m) {
6868
public static final Set<String> requiredKeys = Set.of();
6969
public static final Set<String> optionalKeys = Set.of(
7070
"name",
71-
"additionalProperty",
71+
"someProperty",
7272
"secondAdditionalProperty"
7373
);
7474
public static ItemsSchemaMap of(Map<String, ? extends @Nullable Object> arg, SchemaConfiguration configuration) throws ValidationException {
@@ -85,12 +85,12 @@ public String name() throws UnsetPropertyException {
8585
return (String) value;
8686
}
8787

88-
public String additionalProperty() throws UnsetPropertyException {
89-
String key = "additionalProperty";
88+
public String someProperty() throws UnsetPropertyException {
89+
String key = "someProperty";
9090
throwIfKeyNotPresent(key);
9191
@Nullable Object value = get(key);
9292
if (!(value instanceof String)) {
93-
throw new RuntimeException("Invalid value stored for additionalProperty");
93+
throw new RuntimeException("Invalid value stored for someProperty");
9494
}
9595
return (String) value;
9696
}
@@ -123,14 +123,14 @@ default T name(String value) {
123123
}
124124
}
125125

126-
public interface SetterForAdditionalProperty <T> {
126+
public interface SetterForSomeProperty <T> {
127127
Map<String, @Nullable Object> getInstance();
128-
T getBuilderAfterAdditionalProperty(Map<String, @Nullable Object> instance);
128+
T getBuilderAfterSomeProperty(Map<String, @Nullable Object> instance);
129129

130-
default T additionalProperty(String value) {
130+
default T someProperty(String value) {
131131
var instance = getInstance();
132-
instance.put("additionalProperty", value);
133-
return getBuilderAfterAdditionalProperty(instance);
132+
instance.put("someProperty", value);
133+
return getBuilderAfterSomeProperty(instance);
134134
}
135135
}
136136

@@ -145,11 +145,11 @@ default T secondAdditionalProperty(String value) {
145145
}
146146
}
147147

148-
public static class ItemsSchemaMapBuilder extends UnsetAddPropsSetter<ItemsSchemaMapBuilder> implements GenericBuilder<Map<String, @Nullable Object>>, SetterForName<ItemsSchemaMapBuilder>, SetterForAdditionalProperty<ItemsSchemaMapBuilder>, SetterForSecondAdditionalProperty<ItemsSchemaMapBuilder> {
148+
public static class ItemsSchemaMapBuilder extends UnsetAddPropsSetter<ItemsSchemaMapBuilder> implements GenericBuilder<Map<String, @Nullable Object>>, SetterForName<ItemsSchemaMapBuilder>, SetterForSomeProperty<ItemsSchemaMapBuilder>, SetterForSecondAdditionalProperty<ItemsSchemaMapBuilder> {
149149
private final Map<String, @Nullable Object> instance;
150150
private static final Set<String> knownKeys = Set.of(
151151
"name",
152-
"additionalProperty",
152+
"someProperty",
153153
"secondAdditionalProperty"
154154
);
155155
public Set<String> getKnownKeys() {
@@ -167,7 +167,7 @@ public ItemsSchemaMapBuilder() {
167167
public ItemsSchemaMapBuilder getBuilderAfterName(Map<String, @Nullable Object> instance) {
168168
return this;
169169
}
170-
public ItemsSchemaMapBuilder getBuilderAfterAdditionalProperty(Map<String, @Nullable Object> instance) {
170+
public ItemsSchemaMapBuilder getBuilderAfterSomeProperty(Map<String, @Nullable Object> instance) {
171171
return this;
172172
}
173173
public ItemsSchemaMapBuilder getBuilderAfterSecondAdditionalProperty(Map<String, @Nullable Object> instance) {
@@ -205,7 +205,7 @@ protected ItemsSchema1() {
205205
.type(Set.of(Map.class))
206206
.properties(Map.ofEntries(
207207
new PropertyEntry("name", Name.class),
208-
new PropertyEntry("additionalProperty", AdditionalProperty.class),
208+
new PropertyEntry("someProperty", SomeProperty.class),
209209
new PropertyEntry("secondAdditionalProperty", SecondAdditionalProperty.class)
210210
))
211211
);

samples/client/petstore/python/docs/components/schema/items_schema.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: typing.Mapping[str, schemas.INPUT_TYPES_ALL]
1616
Key | Type | Description | Notes
1717
------------ | ------------- | ------------- | -------------
1818
**name** | str | | [optional]
19-
**additionalProperty** | str | | [optional]
19+
**someProperty** | str | | [optional]
2020
**secondAdditionalProperty** | str | | [optional]
2121
**any_string_name** | dict, schemas.immutabledict, list, tuple, decimal.Decimal, float, int, str, datetime.date, datetime.datetime, uuid.UUID, bool, None, bytes, io.FileIO, io.BufferedReader, schemas.FileIO | any string name can be used but the value must be the correct type | [optional]
2222

@@ -29,15 +29,15 @@ base class: schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]
2929
Keyword Argument | Type | Description | Notes
3030
---------------- | ---- | ----------- | -----
3131
**name** | str, schemas.Unset | | [optional]
32-
**additionalProperty** | str, schemas.Unset | | [optional]
32+
**someProperty** | str, schemas.Unset | | [optional]
3333
**secondAdditionalProperty** | str, schemas.Unset | | [optional]
3434
**kwargs** | schemas.immutabledict, tuple, float, int, str, bool, None, bytes, schemas.FileIO | any string name can be used but the value must be the correct type | [optional] typed value is accessed with the get_additional_property_ method
3535

3636
### properties
3737
Property | Type | Description | Notes
3838
-------- | ---- | ----------- | -----
3939
**name** | str, schemas.Unset | | [optional]
40-
**additionalProperty** | str, schemas.Unset | | [optional]
40+
**someProperty** | str, schemas.Unset | | [optional]
4141
**secondAdditionalProperty** | str, schemas.Unset | | [optional]
4242

4343
### methods

samples/client/petstore/python/src/petstore_api/components/schema/items_schema.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
from petstore_api.shared_imports.schema_imports import * # pyright: ignore [reportWildcardImportFromLibrary]
1212

1313
Name: typing_extensions.TypeAlias = schemas.StrSchema
14-
AdditionalProperty: typing_extensions.TypeAlias = schemas.StrSchema
14+
SomeProperty: typing_extensions.TypeAlias = schemas.StrSchema
1515
SecondAdditionalProperty: typing_extensions.TypeAlias = schemas.StrSchema
1616
Properties = typing.TypedDict(
1717
'Properties',
1818
{
1919
"name": typing.Type[Name],
20-
"additionalProperty": typing.Type[AdditionalProperty],
20+
"someProperty": typing.Type[SomeProperty],
2121
"secondAdditionalProperty": typing.Type[SecondAdditionalProperty],
2222
}
2323
)
@@ -29,7 +29,7 @@ class ItemsSchemaDict(schemas.immutabledict[str, schemas.OUTPUT_BASE_TYPES]):
2929
})
3030
__optional_keys__: typing.FrozenSet[str] = frozenset({
3131
"name",
32-
"additionalProperty",
32+
"someProperty",
3333
"secondAdditionalProperty",
3434
})
3535

@@ -40,7 +40,7 @@ def __new__(
4040
str,
4141
schemas.Unset
4242
] = schemas.unset,
43-
additionalProperty: typing.Union[
43+
someProperty: typing.Union[
4444
str,
4545
schemas.Unset
4646
] = schemas.unset,
@@ -54,7 +54,7 @@ def __new__(
5454
arg_: typing.Dict[str, typing.Any] = {}
5555
for key_, val in (
5656
("name", name),
57-
("additionalProperty", additionalProperty),
57+
("someProperty", someProperty),
5858
("secondAdditionalProperty", secondAdditionalProperty),
5959
):
6060
if isinstance(val, schemas.Unset):
@@ -85,8 +85,8 @@ def name(self) -> typing.Union[str, schemas.Unset]:
8585
)
8686

8787
@property
88-
def additionalProperty(self) -> typing.Union[str, schemas.Unset]:
89-
val = self.get("additionalProperty", schemas.unset)
88+
def someProperty(self) -> typing.Union[str, schemas.Unset]:
89+
val = self.get("someProperty", schemas.unset)
9090
if isinstance(val, schemas.Unset):
9191
return val
9292
return typing.cast(

src/test/resources/3_0/python/petstore_customized.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3469,7 +3469,7 @@ components:
34693469
properties:
34703470
name:
34713471
type: string
3472-
additionalProperty:
3472+
someProperty:
34733473
type: string
34743474
secondAdditionalProperty:
34753475
type: string

0 commit comments

Comments
 (0)