Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

responsibleapi/responsible

Open more actions menu

Repository files navigation

ResponsibleAPI

A small language that compiles to OpenAPI 3.1.0.

Language

Responsible is based on KDL 1.0.0.

Compiling to OpenAPI

Once you've created your Responsible file, you can unlock all of the OpenAPI tooling:

bunx @responsibleapi/cli responsible.kdl -o /tmp/openapi.json

Below is some of the OpenAPI tooling provided by Responsible and third parties.

Validating requests

Typescript

See packages/hono/README.md

Kotlin

Use the built-in OpenAPI request validator.

Generating a client:

Install

brew install openapi-generator

Typescript

openapi-generator generate -g typescript-fetch -i /tmp/openapi.json -o gen/ --additional-properties=typescriptThreePlus=true,modelPropertyNaming=original,nullSafeAdditionalProps=true,enumPropertyNaming=original,supportsES6=true,useSingleRequestParameter=false

Kotlin

openapi-generator generate -g kotlin -i /tmp/openapi.json -o gen/ --additional-properties=library=jvm-vertx

Testing

The idea behind testing with OpenAPI is validating server responses against the contract.

Kotlin

Vert.x

See https://github.com/responsibleapi/test-kotlin-vertx

Python

To be published, see https://github.com/listenbox/yanic/blob/master/tests/responsible.py

Typescript

Hono

Responsible Hono version

bun install @responsibleapi/hono
const responsible = new Responsible<keyof Handlers, AppEnv>(
  openApiInternal as oas31.OpenAPIObject,
  hono,
)

test("signup", async () => {
  await responsible.check("signup", {
    req: {
      body: {
        name: genStr(),
        email: genEmail(),
        password: genStr(),
      },
    },
    status: 201,
  })
})

Fuzzing

Use https://schemathesis.io for now

brew install uv
uvx schemathesis run --checks all --base-url http://localhost:8080 --workers 40 src/main/resources/openapi.json

Ultimately the plan is to integrate fuzzing into the testing libraries.

See also

About

A small language that compiles to OpenAPI

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.