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

[Schema Inaccuracy] POST /repos/{owner}/{repo}/check-runs requestBody has anyOf but should be oneOf #228

Closed
gr2m opened this issue Mar 8, 2021 · 1 comment

Comments

@gr2m
Copy link
Collaborator

gr2m commented Mar 8, 2021

This bug is blocking octokit/types.ts#283 @imwiss /cc @tlbdk

Same problem as #220, but this time for PATCH /repos/{owner}/{repo}/check-runs/{check_run_id} instead of POST /repos/{owner}/{repo}/check-runs. If it's the same schema, maybe it could be referenced?

Schema Inaccuracy

              anyOf:
              - properties:
                  status:
                    enum:
                    - completed
                required:
                - conclusion
                additionalProperties: true
              - properties:
                  status:
                    enum:
                    - queued
                    - in_progress
                additionalProperties: true
Full schema for PATCH /repos/{owner}/{repo}/check-runs/{check_run_id}
    patch:
      summary: Update a check run
      description: |-
        **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array.

        Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs.
      tags:
      - checks
      operationId: checks/update
      externalDocs:
        description: API method documentation
        url: https://docs.github.com/rest/reference/checks#update-a-check-run
      parameters:
      - "$ref": "#/components/parameters/owner"
      - "$ref": "#/components/parameters/repo"
      - "$ref": "#/components/parameters/check_run_id"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: The name of the check. For example, "code-coverage".
                details_url:
                  type: string
                  description: The URL of the integrator's site that has the full
                    details of the check.
                external_id:
                  type: string
                  description: A reference for the run on the integrator's system.
                started_at:
                  type: string
                  description: 'This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
                    format: `YYYY-MM-DDTHH:MM:SSZ`.'
                status:
                  type: string
                  description: The current status. Can be one of `queued`, `in_progress`,
                    or `completed`.
                  enum:
                  - queued
                  - in_progress
                  - completed
                conclusion:
                  type: string
                  description: "**Required if you provide `completed_at` or a `status`
                    of `completed`**. The final conclusion of the check. Can be one
                    of `action_required`, `cancelled`, `failure`, `neutral`, `success`,
                    `skipped`, `stale`, or `timed_out`.  \n**Note:** Providing `conclusion`
                    will automatically set the `status` parameter to `completed`.
                    You cannot change a check run conclusion to `stale`, only GitHub
                    can set this."
                  enum:
                  - action_required
                  - cancelled
                  - failure
                  - neutral
                  - success
                  - skipped
                  - stale
                  - timed_out
                completed_at:
                  type: string
                  description: 'The time the check completed. This is a timestamp
                    in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format:
                    `YYYY-MM-DDTHH:MM:SSZ`.'
                output:
                  type: object
                  description: Check runs can accept a variety of data in the `output`
                    object, including a `title` and `summary` and can optionally provide
                    descriptive details about the run. See the [`output` object](https://docs.github.com/rest/reference/checks#output-object-1)
                    description.
                  properties:
                    title:
                      type: string
                      description: "**Required**."
                    summary:
                      type: string
                      description: Can contain Markdown.
                      maxLength: 65535
                    text:
                      type: string
                      description: Can contain Markdown.
                      maxLength: 65535
                    annotations:
                      type: array
                      description: Adds information from your analysis to specific
                        lines of code. Annotations are visible in GitHub's pull request
                        UI. Annotations are visible in GitHub's pull request UI. The
                        Checks API limits the number of annotations to a maximum of
                        50 per API request. To create more than 50 annotations, you
                        have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run)
                        endpoint. Each time you update the check run, annotations
                        are appended to the list of annotations that already exist
                        for the check run. For details about annotations in the UI,
                        see "[About status checks](https://help.github.com/articles/about-status-checks#checks)".
                        See the [`annotations` object](https://docs.github.com/rest/reference/checks#annotations-object-1)
                        description for details.
                      maxItems: 50
                      items:
                        type: object
                        properties:
                          path:
                            type: string
                            description: The path of the file to add an annotation
                              to. For example, `assets/css/main.css`.
                          start_line:
                            type: integer
                            description: The start line of the annotation.
                          end_line:
                            type: integer
                            description: The end line of the annotation.
                          start_column:
                            type: integer
                            description: The start column of the annotation. Annotations
                              only support `start_column` and `end_column` on the
                              same line. Omit this parameter if `start_line` and `end_line`
                              have different values.
                          end_column:
                            type: integer
                            description: The end column of the annotation. Annotations
                              only support `start_column` and `end_column` on the
                              same line. Omit this parameter if `start_line` and `end_line`
                              have different values.
                          annotation_level:
                            type: string
                            description: The level of the annotation. Can be one of
                              `notice`, `warning`, or `failure`.
                            enum:
                            - notice
                            - warning
                            - failure
                          message:
                            type: string
                            description: A short description of the feedback for these
                              lines of code. The maximum size is 64 KB.
                          title:
                            type: string
                            description: The title that represents the annotation.
                              The maximum size is 255 characters.
                          raw_details:
                            type: string
                            description: Details about this annotation. The maximum
                              size is 64 KB.
                        required:
                        - path
                        - start_line
                        - end_line
                        - annotation_level
                        - message
                    images:
                      type: array
                      description: Adds images to the output displayed in the GitHub
                        pull request UI. See the [`images` object](https://docs.github.com/rest/reference/checks#annotations-object-1)
                        description for details.
                      items:
                        type: object
                        properties:
                          alt:
                            type: string
                            description: The alternative text for the image.
                          image_url:
                            type: string
                            description: The full URL of the image.
                          caption:
                            type: string
                            description: A short image description.
                        required:
                        - alt
                        - image_url
                  required:
                  - summary
                actions:
                  type: array
                  description: Possible further actions the integrator can perform,
                    which a user may trigger. Each action includes a `label`, `identifier`
                    and `description`. A maximum of three actions are accepted. See
                    the [`actions` object](https://docs.github.com/rest/reference/checks#actions-object)
                    description. To learn more about check runs and requested actions,
                    see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)."
                  maxItems: 3
                  items:
                    type: object
                    properties:
                      label:
                        type: string
                        maxLength: 20
                        description: The text to be displayed on a button in the web
                          UI. The maximum size is 20 characters.
                      description:
                        type: string
                        maxLength: 40
                        description: A short explanation of what this action would
                          do. The maximum size is 40 characters.
                      identifier:
                        type: string
                        maxLength: 20
                        description: A reference for the action on the integrator's
                          system. The maximum size is 20 characters.
                    required:
                    - label
                    - description
                    - identifier
              anyOf:
              - properties:
                  status:
                    enum:
                    - completed
                required:
                - conclusion
                additionalProperties: true
              - properties:
                  status:
                    enum:
                    - queued
                    - in_progress
                additionalProperties: true

Expected

              oneOf:
              - properties:
                  status:
                    enum:
                    - completed
                required:
                - status
                - conclusion
                additionalProperties: true
              - properties:
                  status:
                    enum:
                    - queued
                    - in_progress
                additionalProperties: true

Reproduction Steps

n/a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant