feat(golang): support for wrapped and xml name#21899
feat(golang): support for wrapped and xml name#21899wing328 merged 3 commits intoOpenAPITools:masterfrom
Conversation
|
@wing328 low hanging fruit with a easy fix and big impact. Ready to review and to be merged. |
|
@sruehl thanks for the PR what about updating modules/openapi-generator/src/test/resources/3_0/go/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml with some test schemas to cover this change moving forward? |
|
I added two array types for wrapped to that file you mentioned |
- with name - without name
3a14e19 to
8426f4b
Compare
|
please commit the new files as well |
that's the general one. Go petstore samples use a different one |
whoops, will do, wasn't aware that that ends up in a sample, sorry :( |
|
@wing328 samples updated |
|
i did a test locally with the --- a/samples/openapi3/client/petstore/go/go-petstore/model_pet.go
+++ b/samples/openapi3/client/petstore/go/go-petstore/model_pet.go
@@ -20,14 +20,14 @@ var _ MappedNullable = &Pet{}
// Pet struct for Pet
type Pet struct {
- Id *int64 `json:"id,omitempty"`
- Category *Category `json:"category,omitempty"`
- Name string `json:"name"`
- PhotoUrls []string `json:"photoUrls"`
- Tags []Tag `json:"tags,omitempty"`
+ Id *int64 `json:"id,omitempty" xml:"id"`
+ Category *Category `json:"category,omitempty" xml:"category"`
+ Name string `json:"name" xml:"name"`
+ PhotoUrls []string `json:"photoUrls" xml:"photoUrls>photoUrl"`
+ Tags []Tag `json:"tags,omitempty" xml:"tags>tag"`
// pet status in the store
// Deprecated
- Status *string `json:"status,omitempty"`
+ Status *string `json:"status,omitempty" xml:"status"`
AdditionalProperties map[string]interface{}
}
does the change (e.g. |
|
let's give it a try i'll add some tests for the withXml option later thanks for the contribution |
yes I does |
|
fyi. merged #21913 to add tests for the withXml option |
|
thx, I left some comments there |
* feat(golang): support for wrapped and xml name * test(golang): add two test cases for wrapped - with name - without name * chore(golang): update samples

Resolves #21898
This PR enables wrapped and xml name support in Golang
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)