Skip to content

[Go] Skipping marshalling of readonly fields#14335

Merged
wing328 merged 2 commits intoOpenAPITools:masterfrom
gcatanese:12551-go-skip-marshal-readonly-fields
Jan 2, 2023
Merged

[Go] Skipping marshalling of readonly fields#14335
wing328 merged 2 commits intoOpenAPITools:masterfrom
gcatanese:12551-go-skip-marshal-readonly-fields

Conversation

@gcatanese
Copy link
Copy Markdown
Contributor

@gcatanese gcatanese commented Dec 28, 2022

Fix #12551

Readonly fields to be ignored during toSerialize

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@gcatanese
Copy link
Copy Markdown
Contributor Author

@wing328 I have created a new PR that supersedes PR #13875

@wing328
Copy link
Copy Markdown
Member

wing328 commented Jan 2, 2023

cc @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @jirikuncar (2021/01) @ph4r5h4d (2021/04)

@wing328 wing328 added this to the 6.3.0 milestone Jan 2, 2023
@wing328 wing328 merged commit d0800c4 into OpenAPITools:master Jan 2, 2023
@wing328 wing328 changed the title 12551 [Go] Skipping marshalling of readonly fields [Go] Skipping marshalling of readonly fields Jan 2, 2023
@samvdb
Copy link
Copy Markdown

samvdb commented Mar 10, 2023

Why are readOnly fields skipped in marshaling? ReadOnly indicates you can't change the value. When marshaling the object you want to output the value of that field to the consumer of the REST api. The field SHOULD be included in the json response.

When unmarshaling the field should be dropped. I believe this PR is very wrong, can someone explain to me if this is expected behaviour?

Thanks

@gcatanese
Copy link
Copy Markdown
Contributor Author

Why are readOnly fields skipped in marshaling? ReadOnly indicates you can't change the value. When marshaling the object you want to output the value of that field to the consumer of the REST api. The field SHOULD be included in the json response.

When unmarshaling the field should be dropped. I believe this PR is very wrong, can someone explain to me if this is expected behaviour?

Thanks

@samvdb Sorry for the late reply. Yes, you are right, that is a mistake. I am going to address it asap. Thank you.

@gcatanese gcatanese mentioned this pull request Jun 5, 2023
6 tasks
@gcatanese
Copy link
Copy Markdown
Contributor Author

See PR #15765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [GO] ReadOnly fields are marshaled into json

3 participants