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

Expose the CALM CLI as a RESTful API #689

Open
Budlee opened this issue Dec 17, 2024 · 3 comments
Open

Expose the CALM CLI as a RESTful API #689

Budlee opened this issue Dec 17, 2024 · 3 comments
Assignees
Labels

Comments

@Budlee
Copy link
Member

Budlee commented Dec 17, 2024

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.

calm server -p 8080

This new option would then spin up a simple server to host the calm cli as a simple restful API that can be called by other applications.
A restful API will provide better interopoability for other services that want to utilise what has been built in the CLI.
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.

calm server -p 8080
java myApp --validate-calm localhost:8080

TAG: @jpgough-ms @rocketstack-matt

@rocketstack-matt
Copy link
Member

@Thels have you already picked this up? If so can you assign to yourself, thanks!

@Thels
Copy link
Member

Thels commented Dec 19, 2024

I did play around with spinning up an expressJS server as part of a calm server command - and that's went fine ( and I can raise a PR for that small amount of work ). But ran into some problems with trying to test it in the cli.spec.ts - but a proper implementation tackling this issue would need;

  • OpenAPI support - likely moving to https://hono.dev/ as it has great OpenAPI support and is very Express like.
  • Definition of what API's we want to expose ( for example do we want to expose all formats of output validation or only JSON )

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.

@Thels Thels self-assigned this Dec 19, 2024
@Thels
Copy link
Member

Thels commented Dec 19, 2024

@Thels have you already picked this up? If so can you assign to yourself, thanks!

But fair point on the assignee - fixed it to myself now.

@jpgough-ms jpgough-ms added the CLI label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants