-
Notifications
You must be signed in to change notification settings - Fork 39
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
Expose the CALM CLI as a RESTful API #689
Comments
@Thels have you already picked this up? If so can you assign to yourself, thanks! |
I did play around with spinning up an
I'll take another stab at this tomorrow as my day is looking quite empty, at least if it's formalizing the "starting point" I mentioned at the top of this PR. |
But fair point on the assignee - fixed it to myself now. |
After the discussion in the Office Hours call (#776) we want to re-scope this issue. @jpgough-ms shall we close this open a new one or just edit the title and provide and update in the initial description. |
Discussed briefly on a call;
|
@Budlee perhaps just repurpose this one, as after discussion it can be changed to represent more accurately what we are trying to do with the history/context? |
Updated the ticket to be more representative |
Proposed workings of the Validate endpointWhen looking at the CALM cli Validation command I think there are four key values -p, --pattern <pattern> Path to the pattern file to use. May be a file path or a URL.
-i, --instantiation <instantiation> Path to the pattern instantiation file to use. May be a file path or a URL.
-m, --metaSchemasLocation <metaSchemaLocation> The location of the directory of the meta schemas to be loaded (default: "/usr/local/lib/node_modules/@finos/calm-cli/dist/calm/meta")
-f, --format <format> The format of the output (choices: "json", "junit", default: "json") As this proposal is worked through it should answer how these 4 are specified/resolved in the cli server operation My proposal on the validation endpoint as part of the CALM CLI Server is to allow the API Consumer to pass in a pattern instantiation that should be validated.
This POST resolves three of the required arguments:
As the pattern is listed in the calm instantiation it will need to be looked up. clam server --schema-locations folderSchemasDraft2024.10,folderPatterns,folderSchemasDraft2024.12 This solves the arguments of When/If the CLI is dockerized then it becomes straight forward to mount the folders we want into the container. Endpoint reasoningI think that if we use the endpoint I'd appreciate this and others thoughts on this idea of the implementation. |
The only potential issue I see with what you're proposing above is the Is there any reason why you would want to pass in the CALM folders at start-up as opposed to having them part of the payload? Not against it just curious if you considered it as an alternative. Going onto specifics of validate, that may fall out of the scope of this issue but could impact the vision.
|
I think this is a good approach - pre-load the pattern file in by having it configured as a metaschema location.
We definitely need to rework schema-location to take multiple options, and we should also apply this rework to the other commands to keep things consistent. I also agree with @Thels - let's just do JSON-only for now. The pretty output is just not something we'd need on the server, and the JUnit format is for test evidence in CI so probably doesn't overlap all that much with the server in terms of usage |
Firstly thanks @willosborne and @Thels for the feedback @Thels, I don't like having to pass in the pattern with the payload as I think it's more secure that you are defining upfront all the patterns available to be used and not allowing "junk" to be used to validate against. Let's go with one folder for the time being and just output JSON. @Thels i can have a crack at implementing what I am proposing if that's okay with you. @rocketstack-matt are you happy with this and having it as an experimental feature that could go in? |
Hey, I've been building the server and I have found a couple of issues with the validation and the schemaDirectory.
|
|
Feature Request
Description of Problem:
The problem that I face is that I am working with dockerized Java appliation and would like to use the calm validation that has been created within the CALM cli.
Currently there is no easy way to access the CLI from a dockerized application as it requires the cli to be added to the container then calling to the system process to run the cli and looking at the output.
This is a less than optimal solution.
Potential Solutions:
I would like to propose is to add an option to the calm cli labelled
server
.This new option would then spin up a simple server to host the calm cli validation behaviour as an API endpoint that can be called by other applications.
The validation endpoint as an API will provide better interopoability for other services that want to utilise what has been built.
Additionally the process of dockerizing and running such an application would be more straight forward, it would be great id the CLI could be put onto dockerhub
I see this being used as a sidecar that an application can call locally.
TAG: @jpgough-ms @rocketstack-matt
The text was updated successfully, but these errors were encountered: