Skip to content

Commit 2874ca5

Browse files
authored
Merge pull request #1673 from yue9944882/doc/registering-generated-class-by-mapper
Doc: Registering generated classes via model mapper
2 parents 8b08ec3 + 8dea414 commit 2874ca5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/generate-model-from-third-party-resources.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,19 @@ GenericKubernetesApi<V1CronTab, V1CronTabList> crontabClient =
131131
.throwsApiException();
132132
```
133133
134+
#### Loading generated model from Yaml
135+
136+
In order to make the Yaml codec recognizes the generated model classes, we need to do the registration
137+
by `ModelMapper`:
138+
139+
```java
140+
static {
141+
ModelMapper.addModelMap("com.example.stable", "v1", "crontabs", V1CronTab.class);
142+
// alternative:
143+
// ModelMapper.addModelMap("com.example.stable", "v1", "crontabs", V1CronTab.class, V1CronTabList.class);
144+
}
145+
```
146+
134147
135148
136149

0 commit comments

Comments
 (0)