Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Document.Info members mutable #390

Merged
merged 1 commit into from
Jan 18, 2025

Conversation

wwalexander
Copy link
Contributor

@wwalexander wwalexander commented Jan 17, 2025

I'm working on a project that requires lots of individual mutation of the entire Document structure, and I couldn't find a particular reason why all the Document.Info fields are immutable. The rest of the Document structure seems to be mutable. Wondering if there's something I'm overlooking. Thanks so much for this awesome package 😀

I'm working on a project that requires lots of individual mutation of the entire Document structure, and I couldn't find a particular reason why all the Document.Info fields are immutable. The rest of the structure seems to be mutable and I couldn't find a particular reason why these members need to be immutable. Wondering if there's something I'm overlooking. Thanks so much for this awesome package 😀
@mattpolzin
Copy link
Owner

I've always preferred an explicitly immutable style of programming so I wrote much of OpenAPIKit with that bias. I've since introduced vars in many places as you noted to make things more ergonomic in Swift so the changes you are proposing here look good to me.

@wwalexander
Copy link
Contributor Author

Awesome! I also generally tend towards immutability-by-default, but SwiftUI bindings have led me to generally prefer mutability-by-default in Swift, which has the nice side effect of being somewhat self-documenting in terms of which properties are computed/derived.

@mattpolzin mattpolzin merged commit 749ceba into mattpolzin:main Jan 18, 2025
25 checks passed
@mattpolzin
Copy link
Owner

wwalexander added a commit to wwalexander/OpenAPIKit that referenced this pull request Jan 19, 2025
I realized there are addtional immutable properties within the Document structure that I didn't address in mattpolzin#390, specifically those of Contact and Route.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants