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

feat: add post endpoints #2124

Merged
merged 13 commits into from
Sep 28, 2023

Conversation

andrewelamb
Copy link
Contributor

@andrewelamb andrewelamb commented Sep 14, 2023

This pr add the POST endpoints from the current API:

  • /model/submit split into /submitManifestJson and /submitManifestCsv
  • /model/validate split into /validateManifestJson and /validateManifestCsv

Fixes fds-901
Fixes fds-902

@andrewelamb
Copy link
Contributor Author

@tschaffter I'm having several issues, but the first one to address is described in this issue

When using this branch, the /submitManifestCsv endpoint doesn't have the option to upload a file in the swagger ui.

The current requestBody looks like:

  requestBody:
    description: .csv file
    content:
      application/csv:
        schema:
          type: string
          format: binary

I've also tried application/octet-stream instead of application/csv as per the linked issue, but that didn't work either.

@tschaffter
Copy link
Member

@andrewelamb This is the first time I encounter this use case. I checked first that Swagger UI had a widget to upload files, which it does according to the screenshot in this PR.

I tried your request body in Swagger Editor by modifying the default pet store API:

openapi: 3.0.3
info:
  title: Swagger Petstore - OpenAPI 3.0
  version: 1.0.11
externalDocs:
  description: Find out more about Swagger
  url: http://swagger.io
servers:
  - url: https://petstore3.swagger.io/api/v3
paths:
  /pet:
    post:
      tags:
        - pet
      summary: Add a new pet to the store
      description: Add a new pet to the store
      operationId: addPet
      requestBody:
        description: .csv file
        content:
          application/csv:
            schema:
              type: string
              format: binary
        required: true
      responses:
        '200':
          description: Successful operation

endpoint doesn't have the option to upload a file in the swagger ui.

Did you click on the "Try it out" button? The upload button does not show up in the Swagger Editor until you do.

Before clicking on the button:

image

After clicking:

image

Otherwise, there may be an issue with the Python package in the project that generate the Swagger UI.

@andrewelamb
Copy link
Contributor Author

@tschaffter You are correct, clicking the "try it out button" did make that appear. Thanks for looking at this!

@andrewelamb andrewelamb marked this pull request as ready for review September 27, 2023 17:29
@andrewelamb andrewelamb merged commit 84e216b into Sage-Bionetworks:main Sep 28, 2023
6 checks passed
@andrewelamb andrewelamb deleted the feature-post-endpoints branch September 28, 2023 16:29
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 this pull request may close these issues.

3 participants