Skip to content

Convert response model property accessors from protected to the more appropriate private for consistency#2565

Merged
nickfloyd merged 1 commit intomainfrom
convert-response-model-accessors
Sep 12, 2022
Merged

Convert response model property accessors from protected to the more appropriate private for consistency#2565
nickfloyd merged 1 commit intomainfrom
convert-response-model-accessors

Conversation

@nickfloyd
Copy link
Copy Markdown
Contributor

@nickfloyd nickfloyd commented Sep 8, 2022

Apologies in advance for the size of this PR. Fortunately, the change set is a redundant change across classes.

From the issue:

As we start making our way toward generating models based on the OpenAPI definitions from the GitHub REST API, we need to do some pre-work to help us know what the result of the generated code might look like. This begins with standardization, establishing patterns, and approaches to building our models.

One area where we need to do this is with our response models. Given that most of them have constructors now, we should be able to move to a standardized way of writing these models.

Notes about the changes in this PR:

  • The existing serialization and hydration tests cover this changeset
  • Common and request models will be modified in a separate PR if needed
  • Some object properties could not be changed due to inheritance (listed below)

The following models remain unchanged due to inheritance constraints (where the protected accessor is required). We can evaluate these relationships either prior to or post generation (depending on if we approach the generation byte for byte or if it's a complete rewrite):

  • Account
  • Author
  • Authorization
  • CommitContent
  • GitReference
  • InstallationId
  • LicenseMetadata
  • SerchResults

@timrogers
Copy link
Copy Markdown
Contributor

Would these visibility changes be breaking?

@nickfloyd
Copy link
Copy Markdown
Contributor Author

Would these visibility changes be breaking?

Not at all. They are the setters that should be internal to the model, and the fields already become immutable after hydration. So no breaking changes are happening here.

@nickfloyd nickfloyd requested a review from timrogers September 9, 2022 16:38
@nickfloyd nickfloyd merged commit 9ceb188 into main Sep 12, 2022
@nickfloyd nickfloyd deleted the convert-response-model-accessors branch September 12, 2022 15:24
@nickfloyd
Copy link
Copy Markdown
Contributor Author

release_notes: Converts response model property accessors from protected to the more appropriate private for consistency

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

Labels

Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants