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

Upgrade Growstuff API Schema to OpenAPI 3.0 for GPT Integration #3628

Open
spencerthayer opened this issue Feb 4, 2024 · 2 comments
Open

Comments

@spencerthayer
Copy link

spencerthayer commented Feb 4, 2024

Objective

Convert Growstuff's Swagger 2.0 API schema to OpenAPI 3.0 to facilitate GPT-based application integrations.

Tasks

1. Schema Conversion

Update the schema to OpenAPI 3.0, ensuring compliance with the latest standards. Helpful resources:

2. Enhance Documentation

Include examples and detailed endpoint descriptions. Resources for documentation standards:

3. Validation

Use tools to ensure the schema's correctness.

4. Testing

Ensure all endpoints work as expected with the new schema.

5. Deployment

Update deployment processes to reflect schema changes.

Conversion Examples

Swagger 2.0 Example for /crops Endpoint:

swagger: '2.0'
paths:
  /crops:
    get:
      summary: List all crops
      produces:
        - application/json
      responses:
        200:
          description: An array of crops
          schema:
            type: array
            items:
              $ref: '#/definitions/Crop'
definitions:
  Crop:
    type: object
    properties:
      name:
        type: string
      description:
        type: string

Converted OpenAPI 3.0 Example for /crops Endpoint:

openapi: 3.0.0
paths:
  /crops:
    get:
      summary: List all crops
      responses:
        '200':
          description: An array of crops
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Crop'
components:
  schemas:
    Crop:
      type: object
      properties:
        name:
          type: string
        description:
          type: string

Expected Outcome

A compatible OpenAPI 3.0 schema for seamless GPT application integration, enhancing API usability and accessibility.

@CloCkWeRX
Copy link
Collaborator

Pull requests welcome for this one.

We use jsonapi-swagger:

https://github.com/Growstuff/growstuff/blob/dev/Gemfile#L22

Should have good test coverage as well under spec/requests/API/*

@spencerthayer
Copy link
Author

spencerthayer commented Feb 5, 2024

Awesome. I'll look into it. (As soon as I can create an account.)

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

No branches or pull requests

2 participants