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

Filter out NSNull elements from the json dictionary. #50

Merged
merged 1 commit into from
Sep 13, 2017

Conversation

antoniocasero
Copy link
Contributor

This change allows overriding default BuildSettings.

For example:

If I want to keep the attribute SWIFT_OBJC_INTERFACE_HEADER_NAME empty,
(by default it contains some value). I just need to override this value
in the settings spec.

Previously, If I keep property empty, the generated settings value
appear as .

@yonaskolb
Copy link
Owner

Thanks for this @antoniocasero! Yeah there is a known issue with YAMS, and it decoding "" as Null. I've actually filed a bug here jpsim/Yams#53. If they are open to it I'd like to patch it there.

In terms of fixing it in XcodeGen in the meantime, I'd like to address it at a higher level, perhaps in SpecLoader. Are you able to move the fix there, and make it recursively replace all the null values with empty strings?

@yonaskolb
Copy link
Owner

@antoniocasero, if you're interested, I've also just invited you to our swift-xcode slack group for this project and xcodeproj

This change allows us to override default BuildSettings.
For example:

If I want to keep the attribute SWIFT_OBJC_INTERFACE_HEADER_NAME empty,
(by default it contains some value). I just need to override this value
in the settings spec.

Before If I keep property empty, then in the generated settings the value
appear as <null>.

The method implemented recursively loop through the json dictionary
looking for NSNull objects and replace them by an empty string.

Filter out NSNull elements from the json dictionary.

This change allows us to override default BuildSettings.
For example:

If I want to keep the attribute SWIFT_OBJC_INTERFACE_HEADER_NAME empty,
(by default it contains some value). I just need to override this value
in the settings spec.

Before If I keep property empty, then in the generated settings the value
appear as <null>.

The method implemented recursively loop through the json dictionary
looking for NSNull objects and replace them by an empty string.
@antoniocasero
Copy link
Contributor Author

Done. Let me know what you think.

@yonaskolb
Copy link
Owner

Looks like this will do the trick, thanks @antoniocasero!

@yonaskolb yonaskolb merged commit 217b542 into yonaskolb:master Sep 13, 2017
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