-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
feat: allow dumping of configuration JSON Schema #3757
Conversation
This seems like a capability that can be achieved outside of the core project, so I'm not too keen on including it in the command line parameters. In addition, we already have a |
@fatedier Thanks for the input! If including this capability in the shipped binaries is not OK: I'm not an experienced gopher, so can you recommend a good way to include this in a reproducible way (e.g. so that the schema can be shipped with each new version of frp, or whatnot)? |
Or, to put it the other way: what is the best way to get a JSON Schema for the configuration format, if this isn't OK :) |
What are your actual needs? If you need to verify if the configuration file is correct, we provide the "verify" command. Additionally, if the current approach is to generate JSON Schema without modifying the core code, could this be another independent tool? In the expected future, we will be conducting a series of refactoring. I am not very keen on introducing such non-core features at this early stage as they may be disrupted later, which could result in a worse user experience. |
By the way, it is also possible to point out whether there are or how to implement similar features in some well-known projects, if it is possible to comprehensively learn from mature designs, that would be ideal. |
My actual UC is that I have software that generates Now that I actually got around to implement that using a schema generated from this PR, it turns out the generated schema is somewhat incorrect; e.g. Maybe I'll just defer to shelling out to EDIT: Well, that didn't pan out either: #3769 |
Summary
🤖 Generated by Copilot at 657e592
Add a feature to dump the JSON schema of the client and server configuration to stdout. This feature uses the
reflect
andutil
packages and introduces new flags to thefrpc
andfrps
commands. It also adds new dependencies to thego.mod
file.WHY
For software that needs to generate frp configuration programmatically, it's useful to be able to validate the generated configuration before passing it to frp.
That software can now do
./frpc --json_schema > frpc.config.json
and use their favorite JSON Schema validator from there on out.For instance, the generated client configuration schema looks like this: https://gist.github.com/akx/5c1a605e2624ee75131b4a684f235a82
Powered by https://github.com/invopop/jsonschema (❤️)