api/

directory
v0.0.0-...-35c3ecb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0

README

API Directory

This directory contains all API-related files.

Structure

api
├── README.md
├── generated
│   └── alarms.generated.go           # Generated Go code (do not edit manually)
├── openapi.yaml                      # OpenAPI specification
└── tools
    ├── generate.go                   # Code generation script
    └── oapi-codegen.yaml             # Config file for `oapi-codegen` 

How to Generate Server Side Code

go generate ./...

How to Generate Client Side Code

Note: This is simply here for convenience and make sure we don't generate any internal endpoint clients

# overlay
overlay: 1.0.0
info:
  title: "Example to indicate how to use the OpenAPI Overlay specification (https://github.com/OAI/Overlay-Specification) and only generate external client-side code"
  version: 1.0.0
actions:
- target: $.paths.*.*[?(@.tags[*] == 'internal')]
  description: Remove internal endpoints (noted by internal tag)
  remove: true
# oapi-codegen-client-config.yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/oapi-codegen/oapi-codegen/HEAD/configuration-schema.json
package: client
output: client.generated.go

generate:
  client: true
  models: true

output-options:
  overlay:
    path: overlay.yaml

Directories

Path Synopsis
Package generated provides primitives to interact with the openapi HTTP API.
Package generated provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL