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

[BUG]: Example is not used for multipart/form-data #1692

Closed
hoog1511 opened this issue Feb 14, 2023 · 2 comments · Fixed by #1964
Closed

[BUG]: Example is not used for multipart/form-data #1692

hoog1511 opened this issue Feb 14, 2023 · 2 comments · Fixed by #1964
Labels
Core: Data Generation Generating test data Priority: Medium Planned for regular releases Specification: OpenAPI Specific to OpenAPI Type: Bug Errors or unexpected behavior
Milestone

Comments

@hoog1511
Copy link

hoog1511 commented Feb 14, 2023

Is it currently possible to use schemathesis for testing multipart/formdata requests using examples for the entire requestBody?
My API has some backend functionality which needs to be stubbed using the example.

I want to use this for the following schema:

upload_document_input:
      description: A multipart file (in binary [not base64!] format) to upload and the relevant metadata via the body.
      required: true
      content:
        multipart/form-data:
          schema:
            type: object
            required:
              - metadata
              - file
            properties:
              metadata:
                $ref: "#/components/schemas/meta_data"
              file:
                $ref: "#/components/schemas/file_content"
          examples: #is not added in the test output
            requestExample:
              $ref: "#/components/examples/requestExample"

requestExample:
        value: { 
          "requires_indexing": "true",
          "file_name": "MyTestFilename.txt", 
          "scanning_context": { 
            "indexing_code": "AAA", 
            "indexing_group":"ABCD"
          }, 
            "document_metadata": { 
            "document_source": "AAA", 
            "differentiator":"...." 
          } 
        }
@Stranger6667 Stranger6667 added the Status: Needs Triage Requires initial assessment to categorize and prioritize label Oct 16, 2023
@Stranger6667 Stranger6667 added this to the 3.22 milestone Oct 17, 2023
@Stranger6667 Stranger6667 added Priority: Medium Planned for regular releases Type: Bug Errors or unexpected behavior Specification: OpenAPI Specific to OpenAPI Core: Data Generation Generating test data and removed Status: Needs Triage Requires initial assessment to categorize and prioritize labels Oct 18, 2023
@Stranger6667
Copy link
Member

Hi! If requestExample is not used, then it is a bug

@Stranger6667 Stranger6667 changed the title Question regarding multipart/form-data [BUG]: Example is not used for multipart/form-data Oct 18, 2023
@Stranger6667
Copy link
Member

The issue is that examples extracted from references are not used there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core: Data Generation Generating test data Priority: Medium Planned for regular releases Specification: OpenAPI Specific to OpenAPI Type: Bug Errors or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants