[BUG] [GO] can't generate codes with xml tag
See original GitHub issueBug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- What’s the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What’s the actual output vs expected output?
- [] [Optional] Bounty to sponsor the fix (example)
Description
even though i use withXml=true
, can’t generate codes with xml tag .
actual:
type ResponseSample struct {
StatusCode int64 `json:"status_code"`
Message string `json:"message"`
}
expected(like this):
type ResponseSample struct {
XMLName xml.Name `xml:"response"`
StatusCode int64 `xml:"status_code"`
Message string `xml:"message"`
}
My Go version: go version go1.12.13 darwin/amd64
openapi-generator version
v4.1.2
OpenAPI declaration file content or url
ResponseSample:
type: object
properties:
status_code:
type: integer
format: int64
example: 0
message:
type: string
example: 'success'
xml:
name: response
required:
- status_code
- message
Command line used for generation
docker run -v ${PWD}:/local openapitools/openapi-generator-cli:v4.1.2 generate \
-i /local/openapi/openapi.yaml \
-g go-server \
-p withXml=true \
--output /local/${GENERATE_PATH}
Steps to reproduce
please paste the above yaml, then docker run.
Related issues/PRs
https://github.com/OpenAPITools/openapi-generator/issues/490
Suggest a fix
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Unable to parse xml in GO with : in tags - Stack Overflow
Show activity on this post. I find that if tags in XML file have : in them the unmarshal code in Go does...
Read more >Can't open file that contains custom XML elements which are ...
Describes an issue in which a particular custom XML markup implementation is removed in Word 2007, Word 2010 and Word 2013.
Read more >Question: How resolve mal-formed xml error - Boomi Community
I can't get beyond an mal-formed xml error from a Map shpe to a cache shape. Test execution of SF_FX_to_SQL_FFXIntegration_Todd completed ...
Read more >beevik/etree: parse and generate XML easily in go - GitHub
Represents XML documents as trees of elements for easy traversal. Imports, serializes, modifies or creates XML documents from scratch. Writes and reads XML...
Read more >XML Files: What They Are & How to Open Them - HubSpot Blog
An XML file contains XML code and ends with the file extension ".xml". ... To create custom tags, a developer writes a Document...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That’s what we use in the Go Petstore (xml) shell script so it looks to me the following is correct:
--additional-properties withXml=true
If it’s still an issue, please ping me via Slack.
Closing this for the time being.