Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tern REST API Design Doc #1

Closed
nishakm opened this issue Feb 11, 2022 · 2 comments · Fixed by #2
Closed

Tern REST API Design Doc #1

nishakm opened this issue Feb 11, 2022 · 2 comments · Fixed by #2

Comments

@nishakm
Copy link

nishakm commented Feb 11, 2022

Relates to issue tern-tools/tern#1112 and super issue tern-tools/tern#1110

The task is to create an API Design Doc.

@nishakm
Copy link
Author

nishakm commented Feb 12, 2022

Here is a Swagger YAML I constructed using editor.swagger.io:

swagger: "2.0"
info:
  description: "Tern is a software composition analysis tool and Python library that generates a Software Bill of Materials for container images and Dockerfiles. The SBOM that Tern generates will give you a layer-by-layer view of what's inside your container in a variety of formats including human-readable, JSON, HTML, SPDX and more."
  version: "1.0.0"
  title: "Tern Kubernetes Service"
  license:
    name: "BSD-2-Clause"
    url: "https://github.com/tern-tools/tern-api/blob/main/LICENSE.txt"
basePath: "/v1"
schemes:
- "https"
paths:
  /image/repo-tag:
    get:
      tags:
      - "image"
      summary: "Analyze an image by its repository name and tag or repository name and digest"
      description: "Provide the image string domain/org/repo:tag or domain/org/repo@digest_type:digest"
      operationId: "analyzeImage"
      produces:
      - "application/json"
      parameters:
      - name: "format"
        in: "query"
        description: "Return the results in a format. No parameters returns the default JSON format"
        required: false
        type: "string"
        enum:
          - "spdx"
          - "cyclonedx"
      responses:
        "200":
          description: "OK"
          schema:
            type: "object"
        "400":
          description: "Bad Request"
        "404":
          description: "Not Found"

@nishakm
Copy link
Author

nishakm commented Feb 12, 2022

Here is an OpenAPI3 conformant layout:

openapi: 3.0.1
info:
  title: Tern Kubernetes Service
  description: Tern is a software composition analysis tool and Python library that
    generates a Software Bill of Materials for container images and Dockerfiles. The
    SBOM that Tern generates will give you a layer-by-layer view of what's inside
    your container in a variety of formats including human-readable, JSON, HTML, SPDX
    and more.
  license:
    name: BSD-2-Clause
    url: https://github.com/tern-tools/tern-api/blob/main/LICENSE.txt
  version: 1.0.0
servers:
- url: /v1
paths:
  /image/repo-tag:
    get:
      tags:
      - image
      summary: Analyze an image by its repository name and tag or repository name
        and digest
      description: Provide the image string domain/org/repo:tag or domain/org/repo@digest_type:digest
      operationId: analyzeImage
      parameters:
      - name: format
        in: query
        description: Return the results in a format. No parameters returns the default
          JSON format
        schema:
          type: string
          enum:
          - spdx
          - cyclonedx
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                type: object
        400:
          description: Bad Request
          content: {}
        404:
          description: Not Found
          content: {}
components: {}

@rnjudge rnjudge transferred this issue from tern-tools/tern-web-api Feb 16, 2022
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 a pull request may close this issue.

1 participant