-
-
Notifications
You must be signed in to change notification settings - Fork 268
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
Add config schema generation #930
Add config schema generation #930
Conversation
You'd be correct in saying that |
4c7eac9
to
8837303
Compare
e201c96
to
3793d2e
Compare
Thanks! Unfortunately Json.NET Schema isn't free, and the AGPL version is limited to 1000 validations per hour. That could easily be reached in our case (since players can have hundreds or thousands of mods, they may launch the game more than once per hour, and mods often read/write their config files more than once). |
Updated PR to use NJsonSchema. |
The default value of this option is `false` to make it an opt-in feature. External tools, that want to use this feature, would have to set this value to `true`.
052f252
to
130fdba
Compare
Unfortunately NJsonSchema fails for many mods (see log). A few sample cases:
It seems to only work with properties (not fields), and fails with some common types like I rebased the PR branch onto the latest
|
I'll close this as won't do per the above, but feel free to submit a new PR if you can get NJsonSchema or another package to work. Thanks for the help! |
Resolves #928.
Changes
SMAPI.Toolkit
:NJsonSchema
for schema generation.GenerateConfigSchema
option toSConfig
that's set tofalse
by default.IDataHelper.WriteJsonSchemaFile
andJsonHelper.WriteJsonSchemaFile
to generate and write the schema to file.ModHelper.ReadConfig
to generate the fileconfig.schema.json
.Notes
I think
develop
references DLLs from Stardew Valley 1.6 that I don't have access with, so I had to create the code onstable
and port it todevelop
.I'm not sure how to test this PR, there aren't any unit tests that I can run. I thought about installing latest SMAPI normally and just overwriting the DLLs in the game folder with the ones I build using the PR. However, I don't even know if that works with the .NET DLL resolution process...