Skip to content

Add /operations endpoint to list available operations#17

Closed
Boolean263 wants to merge 2 commits intogchq:masterfrom
Boolean263:list-operations
Closed

Add /operations endpoint to list available operations#17
Boolean263 wants to merge 2 commits intogchq:masterfrom
Boolean263:list-operations

Conversation

@Boolean263
Copy link

This is a straightforward change to add a /operations endpoint which
can be used to get a list of the available operations on the CyberChef
server. The returned object has an attribute for each operation name,
with the argument description as its value.

This change also documents this new endpoint in README.md and
swagger.yml.

This is a straightforward change to add a `/operations` endpoint which
can be used to get a list of the available operations on the CyberChef
server. The returned object has an attribute for each operation name,
with the argument description as its value.

This change also documents this new endpoint in `README.md` and
`swagger.yml`.
Copy link
Member

@d98762625 d98762625 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you @Boolean263.

Could you please address:

  • Minor documentation comments inline
  • Add some tests covering the output of your new endpoint (basic "it exists" and maybe the existence of a couple of operation properties)

Much appreciated, thanks a lot 🙌

> For full documentation of the API, you can find the swagger page hosted at the root url. See [Installing](#Installing) to run the application and browse the docs.

Currently the server just has one endpoint: `/bake`. This endpoint accepts a POST request with the following body:
The most important endpoint is `/bake`. This endpoint accepts a POST request with the following body:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this part of the README a list of endpoints with anchor tags to their respective parts of the documentation please?


There is also a `/operations` endpoint. This endpoint accepts a GET request and responds with a JSON object listing the available operations on this server. Each operation name is one attribute, and its value is the description of the arguments it can take.

#### Example: operation list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a section for /operations and put this example under it please

/**
* operationsGet
*/
router.get("/", async (req, res, next) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit of a nit: please could you make this function a function rather than an arrow function, just for consistency please.

type: object
example: >
{
"FromBase64" : {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you define the example response in YAML rather than a string that looks like JSON please. there should be an example of this in swagger.yml now that the magic operation docs are included

@Boolean263
Copy link
Author

I got all your requested changes done, but I couldn't cleanly rebase my changes on master because of other changes you've made. I've set up a fresh pull request (#22) instead.

@Boolean263 Boolean263 closed this Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants