OpenAPITools / OpenAPITools/openapi-generator
[REQ] [GO] Add support for golang []byte with format: byte
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
When generating golang code from openapi 3.0 the following snippet
components:
schemas:
randomByteString:
type: string
format: byte
results in the following
RandomByteString *string `json:"randomByteString,omitempty"
Describe the solution you'd like
I want the .yaml snippet above to generate the following
RandomByteString *[]byte `json:"randomByteString,omitempty"
This is in accordance with the result in Java as seen from the sample in the repo:
inlineObject3.java
public static final String JSON_PROPERTY_BYTE = "byte";
private byte[] _byte;
Describe alternatives you've considered
There are no alternatives.
Additional context
No additional context needed
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Go generator's handling of an OpenAPI schema with type string and format byte, then compare its output with the requested *[]byte result and the Java example in inlineObject3.java. Done means the YAML schema generates the requested Go field type while preserving the shown JSON tag behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100