Use self for member access/assignment in all initializers, decoders, and encoders #700
+170
−167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In order to address #695 we made some targeted fixes (#696, #699) to use explicit-self to avoid clashing with schema property names. This addressed a clash with a specific variable with properties of only certain schemas, but there are more places where we might encounter future issues. Specifically, we have other variable names which might cause a clash (e.g.
storage
anddiscriminator
), and there are other flavours of initializers, encoders, and decoders that were not updated in the targeted fix.In this PR, we update all access and assignment in the generated code dealing with schemas to use explicit-self.
Modifications
Result
Removed some cases where valid OpenAPI docs would produce non-compiling code.
Test Plan
Snippet and reference tests. The latter is actually compiled during the CI.