CGI-FR / CGI-FR/PIMO

[PROPOSAL] New `pimo serve` command for a dynamic API feature

Open
#283 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
43
Forks
16
PR merge metrics
No merged PRs in 30d

Description

## Description
Currently, PIMO offers a command-line interface (CLI) for masking JSON data based on a configuration in a `masking.yml` file. To enhance its flexibility, I propose adding a dynamic API feature, introducing a new `pimo serve` command.

## Proposed Features
- Addition of a new `pimo serve` command to start a dynamic API server.
- Endpoint POST /context/ to dynamically create a context using a `masking.yml` file.
- Example request: `curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/context`
- Endpoint POST /context/{contextID} to mask data based on a specific `masking.yml` file for a context.
- Example request: `curl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-id`
- Endpoint DELETE /context/{contextID} to delete a specific context.
- Example request: `curl -X DELETE http://localhost:8080/context/context-id`

## How to Test
- Run `pimo serve` to start the dynamic API server.
- Send POST requests to create a context, POST requests to mask data, and DELETE requests to delete a context using curl or a similar tool.
- Examples:
- Create context: `curl -X POST -H 'Content-Type: application/x-yaml' -d @'my-masking-file.yml' http://localhost:8080/context`
- Mask data: `curl -X POST -H 'Content-Type: application/json' -d @'input.json' http://localhost:8080/context/context-id`
- Delete context: `curl -X DELETE http://localhost:8080/context/context-id`

## Expected Results
- POST requests to create a context and mask data should return an HTTP 200 response with the masked data.
- DELETE requests to delete a context should return an HTTP 204 response on success.

Contributor guide

Open the contributing guide

Research direction

Start by locating the existing pimo CLI entry point and the code that loads masking.yml, creates contexts, and masks JSON data. Use the proposed pimo serve command and the POST /context/, POST /context/{contextID}, and DELETE /context/{contextID} curl flows as the acceptance checklist; done means the documented 200 and 204 responses work as specified.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend-api-design, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.