-
Notifications
You must be signed in to change notification settings - Fork 55
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
Generate JSON schema of Flogo app descriptor #20
Generate JSON schema of Flogo app descriptor #20
Conversation
BTW, you can validate the default flogo.json against the generated JSON schema at https://www.jsonschemavalidator.net for instance. |
8b223c1
to
b7771f1
Compare
Is there something missing before merging ? |
Hi guys, There is no doubt that we need to provide the schema, the question is do we need this schema generating code or should we just provide the file? I hope we aren't going to be changing the schema much more going forward... but having the code is nice. @mellistibco @vijaynalawade any thoughts? |
I tend to agree with @fm-tibco. A single schema definition in core repo should be good enough to validate any flogo app json. Things like object schema are under consideration that might need app descriptor update. So, it would be better to keep a file which can be updated easily. |
Franck, Vijay, If the flogo app json changes often, you save time and effort by generating the json schema. What advantage do you see in not generating the json schema ? |
The idea behind this was also to facilitate the writing of unit tests with standard Flogo app descriptor. |
I'm not sure why we should generate the schema during build? Why not generate it once and store it in git? We should then look at adding validation to the cli. I'm not sure I see any reason for the schema to generate code in core. If this is just to facilitate unit tests, perhaps the cli can generate whatever code is required via a plugin? |
Regardless, the flow and stream actions should also have schema's for their corresponding resources. I don't think the schema will change much, but the nice thing about this, as part of the travis build, we can generate the schema and if by any chance the schema.json changed, we can catch it there. This assumes the schema generation code generates an identical schema.json if the code hasn't been altered. |
@debovema what specifically are you thinking? microgateway uses the schema for run time validation, are you thinking the same here? |
Validation at runtime could be good. Especially if the validation outputs more readable messages to the end user in case of errors. |
Thats fine, we should also incorporate the validation into the engine as part of startup. What do you mean by validate against the schema during build time? How do you envision this being used in unit tests... do we need to expose a public method given that currently resides in the internal directory? |
@debovema Any reason you closed this PR? I was hoping to incorporate your code in core and also in both flow and stream to validate their resources. |
Sorry it was a false manipulation with mobile phone. |
I am not sure if we can avoid the public method. The package name could be changed though. |
I created project-flogo/flow#4 for flow action definition. |
1bd5a0c
to
1250185
Compare
0f42f7f
to
6031f97
Compare
6031f97
to
af39d7b
Compare
af39d7b
to
261af9b
Compare
Completely inspired by work of @pointlander in https://github.com/project-flogo/microgateway project (see https://github.com/project-flogo/microgateway/tree/e0abd58fba70f73f8bb6e2c68d23f50277700826/internal/schema), I added the required files to generate the JSON schema of the Flogo app descriptor (flogo.json).
This will be very useful to validate against the schema at buildtime / runtime and output the errors to end-users and also to write unit tests.