Skip to content

bug: validate_schema generates empty schemaTest for 204 No Content endpoints #119

Description

DO NOT SUBMIT SECURITY REPORTS HERE

If you have a security vulnerability, please report it following our security policy.

Bug Report

Amazing GitHub Template version:
2.4.0

Current behavior:
When an endpoint has a 204 No Content successful response (no body), o2p creates
the schemaTest variable in the environment but with no value. At test execution,
ajv.compile(null) throws: schema should be object or boolean.
This also propagates to all 4xx test cases of that endpoint, since there is no
success schema to derive the error schema from.

Expected behavior:
204 No Content responses have no body, so no schemaTest variable or AJV validation
block should be generated for them.

Steps to reproduce:

  1. Define an endpoint with a 204 No Content successful response in the OpenAPI spec
  2. Set validate_schema: true in the o2p config
  3. Generate the collection
  4. Run the collection in Postman → schemaTest is null → AJV crash

Related code:
src/generator/validateSchema.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions