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

strong typing of dictionaries #69

Open
gedw99 opened this issue Aug 15, 2021 · 4 comments
Open

strong typing of dictionaries #69

gedw99 opened this issue Aug 15, 2021 · 4 comments

Comments

@gedw99
Copy link

gedw99 commented Aug 15, 2021

I assume all possible plist elements are published somewhere by apple

if so then it would be possible to generate a parser/ inspector for correctness

this would also allow constructing plist files programmatically that are strongly typed and also I take any third party plist and parse it for correctness.

Is this interesting / worthy for go-plist ?

Does apple publish the plist dictionaries sonewhere ?

@gedw99
Copy link
Author

gedw99 commented Aug 15, 2021

Found the key names per Darwin OS here: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/AboutInformationPropertyListFiles.html

Unless they have a better source like xml I will have to scrape the pages and sub pages to build a JSON or yaml file that can be the basis for the plist functionality of parsing for correctness, etc

the main use is to generate Plist files from known constants.

@DHowett
Copy link
Owner

DHowett commented Aug 16, 2021

@gedw99 thanks for filing this! I'm not totally sure what you're asking for, unfortunately. This library supports parsing a plist into fully type-specified storage.

Reading between the lines, though... are you looking for a tool or specification document that will allow you to produce a type description of an existing property list document?

Something like that could be done with type assertions over a map[string]interface{} that you populate using this library, but there's no out-of-the-box support for making that.

Unfortunately, the property list schema only documents what a property list is... and there is no existing schema documentation for different types of plist documents. There's no source that will help you figure out what any given document should contain. ☹️

@gedw99
Copy link
Author

gedw99 commented Aug 20, 2021

Hey @DHowett

Sorry i wrote the original issue from a mobile and realised how my spelling screwed it up.

So basically in the GIOUI project ( https://github.com/gioui ) you can target Web, Desktop and Mobile ( and Apple TV ), and so i am working on a way for each golang package to be able to add to the Packaging Manifest ( Plist for Apple hardware), and so easily build correct manifests.

Here is an example GIOUI project that does Notifications and so needs a Manifest for Security reasons: https://github.com/gioui/gio-example/blob/main/x/notify
https://github.com/gioui/gio-example/blob/main/x/notify/example.app/Contents/Info.plist

Then i had the idea that we also built golang strongly typed PList constants by scraping the Apple web site for then, and generating the Constant with nice Comments.

The Golang packages can then use the constants to build a Manifest.

Plus as a bonus we can parse a Manifest and check the Dictionary keys ( as Apple calls them ) are correct.

Does this make more sense now ???

@gedw99
Copy link
Author

gedw99 commented Aug 20, 2021

I also intend to do the same for Android and Web Manifests.

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

No branches or pull requests

2 participants