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] #/components/schemas/installation-token is should set permissions and repositorySelection as required #442

Open
gr2m opened this issue Jul 5, 2021 · 1 comment

Comments

@gr2m
Copy link
Collaborator

gr2m commented Jul 5, 2021

Schema Inaccuracy

both permissions and repositorySelection are always set when creating an installation access token

    installation-token:
      title: Installation Token
      description: Authentication token for a GitHub App installed on a user or org.
      type: object
      properties:
        token:
          type: string
        expires_at:
          type: string
        permissions:
          "$ref": "#/components/schemas/app-permissions"
        repository_selection:
          type: string
          enum:
          - all
          - selected
        repositories:
          type: array
          items:
            "$ref": "#/components/schemas/repository"
        single_file:
          type: string
          example: README.md
        has_multiple_single_files:
          type: boolean
          example: true
        single_file_paths:
          type: array
          items:
            type: string
          example:
          - config.yml
          - ".github/issue_TEMPLATE.md"
      required:
      - token
      - expires_at

Expected

      # ...
      required:
      - token
      - expires_at
      - permissions
      - repositorySelection

Reproduction Steps

$ curl -X POST -H"Authorization: bearer eyJhbGci..." https://api.github.com/app/installations/1/access_tokens
@mattpage
Copy link
Contributor

mattpage commented Jul 22, 2021

The problem here is more complex since the endpoint may return a lightweight version of the installation token which doesn't have the same required fields.

To clarify:

The schema is only used by the create-installation-access-token operation, but the endpoint returns two different schemas. It just so happens that one of them is a subset of the other. The other being a "lightweight" version.

To fix this, we will need to create two different schemas as possible return values.

@bruce bruce added P3 and removed triaged labels Aug 3, 2021
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

3 participants