Skip to content

Latest commit

 

History

History
38 lines (33 loc) · 919 Bytes

README.md

File metadata and controls

38 lines (33 loc) · 919 Bytes

jsonnet-openapi-spec

A Jsonnet templating library for the OpenAPI spec.

ci status

WARNING: API is incomplete and subject to change.
local openapi = 'jsonnet-openapi-spec/openapi.libsonnet'

{
  'hello-world.json':
    openapi.new()
    .Info(
      openapi.info.new()
      .Title('Hello World')
      .Version('1')
      .Description('Hello World')
    )
    .Path(
      openapi.pathitem.new('/hello')
      .Get(
        openapi.operation.new('getHello')
        .Response(
          openapi.response.new(200)
          .Content(
            openapi.mediatype.new(openapi.mediatype.plaintext)
            .Schema(
              openapi.schema.new(openapi.schema.string)
              .Example('world')
            )
          )
        )
      )
    ),
}