Skip to content

Conversation

@gcatanese
Copy link
Contributor

PR #14335 has mistakenly removed the readOnly fields during the JSON serialization, resulting in models with missing fields.

This PR reverts those changes.

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.
  • In case you are adding a new generator, run the following additional script :
    ./bin/utils/ensure-up-to-date
    
    Commit all changed files.
  • 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
Contributor Author

@wing328 Please see this PR that corrects the bug introduced by #14335

@wing328
Copy link
Member

wing328 commented Jun 7, 2023

thanks for the fix. can you please add a test in samples/openapi3/client/petstore/go/model_test.go to cover this issue moving forward?

@wing328 wing328 added this to the 7.0.0 milestone Jun 7, 2023
@gcatanese
Copy link
Contributor Author

Sure. I have never noticed that before. When do those tests run?

@gcatanese
Copy link
Contributor Author

New test added in model_test.go

@wing328
Copy link
Member

wing328 commented Jun 10, 2023

thanks for adding the test but CI tests failed:

=== RUN   TestReadOnlyFirst
    model_test.go:52: 
        	Error Trace:	/home/circleci/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go/model_test.go:52
        	Error:      	Not equal: 
        	            	expected: *testing.T(&testing.T{common:testing.common{mu:sync.RWMutex{w:sync.Mutex{state:0, sema:0x0}, writerSem:0x0, readerSem:0x0, readerCount:0, readerWait:0}, output:[]uint8(nil), w:testing.indenter{c:(*testing.common)(0xc0001b8820)}, ran:false, failed:false, skipped:false, done:false, helperPCs:map[uintptr]struct {}{0x6d89f3:struct {}{}, 0x6d9cd4:struct {}{}}, helperNames:map[string]struct {}(nil), cleanups:[]func()(nil), cleanupName:"", cleanupPc:[]uintptr(nil), finished:false, inFuzzFn:false, chatty:(*testing.chattyPrinter)(0xc00007b710), bench:false, hasSub:0, raceErrors:0, runner:"testing.tRunner", parent:(*testing.common)(0xc0001111e0), level:1, creator:[]uintptr{0x4e70ee, 0x4e43a2, 0x4e6f97, 0x4e5a79, 0x6e5045, 0x6e9093, 0x439a52, 0x469101}, name:"TestReadOnlyFirst", start:time.Time{wall:0xc1182cac151656b8, ext:21342773301, loc:(*time.Location)(0x9df6c0)}, duration:0, barrier:(chan bool)(0xc0000c69c0), signal:(chan bool)(0xc0000d6690), sub:[]*testing.T(nil), tempDirMu:sync.Mutex{state:0, sema:0x0}, tempDir:"", tempDirErr:error(nil), tempDirSeq:0}, isParallel:false, isEnvSet:false, context:(*testing.testContext)(0xc0000785a0)})
        	            	actual  : string("{\"Bar\":\"Bar value\",\"Baz\":\"Baz value\"}")
        	Test:       	TestReadOnlyFirst
        	Messages:   	{"bar":"Bar value","baz":"Baz value"}
--- FAIL: TestReadOnlyFirst (0.00s)
=== RUN   TestNullableMarshalling

can you please take a look when you've time?

https://app.circleci.com/pipelines/github/OpenAPITools/openapi-generator/24086/workflows/622226ea-baf9-4c39-8561-fa768ab20b1f/jobs/70266

@gcatanese
Copy link
Contributor Author

@wing328 I have fixed the test, thank you

@wing328
Copy link
Member

wing328 commented Jun 10, 2023

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

@wing328 wing328 merged commit f240ed4 into OpenAPITools:master Jun 10, 2023
amakrushin pushed a commit to amakrushin/openapi-generator that referenced this pull request Jun 12, 2023
* Do not skip readOnly fields in ToMap()

* Regenerate sample

* Add test

* Correct test
fmoraespadtec pushed a commit to padteclab/openapi-generator that referenced this pull request Jun 26, 2023
* Do not skip readOnly fields in ToMap()

* Regenerate sample

* Add test

* Correct test
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.

2 participants