Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.
This repository was archived by the owner on May 15, 2023. It is now read-only.

Query params that are not required included in every request like 'optional_fields: 'DATA GOES HERE'' #172

@olenakulik

Description

@olenakulik

I have a configuration for test_gen with different combinations for query params for endpoint:

            get: {
                '200': [{
                    ordering: ['id'],
                    businessUnits: [businessUnits.businessUnit.id],
                    description: 'ordering and filter by business unit'
                }, {
                    limit: 1,
                    offset: 1,
                    description: 'limit and offset'
                }, {
                    businessUnitNames: [businessUnits.businessUnit.name],
                    description: 'filter by business unit names'
                }, {
                    inet: ipRanges.results[1].startAddress,
                    description: 'filter by IPs or CIDRs'
                }, {
                    tags: [annotationTags.results[0].id, annotationTags.results[1].id],
                    description: 'filter by annotation tags id'
                }, {
                    tagNames: [annotationTags.results[0].name],
                    description: 'filter by annotation tags name'
                }, {
                    optional_fields: ['annotation', 'attributionReasons', 'enclosingIpNetwork', 'latestObservationSnapshot', 'latestMapSnapshot'],
                    description: 'include optional fields'
                }, {
                    limit: 10,
                    offset: 0,
                    businessUnitNames: [businessUnits.businessUnit.name],
                    tags: [annotationTags.results[0].id],
                    optional_fields: ['annotation', 'attributionReasons', 'enclosingIpNetwork', 'latestObservationSnapshot', 'latestMapSnapshot'],
                    description: 'limit, offset, filter by BU name and tags with included optional fields'
                }]
            }
        }

All these params are not required, an example from spec:

    description: >
      Comma-separated string; Include the provided fields as part of the
      serialized result.
    in: query
    name: optional_fields
    required: false
    type: array
    collectionFormat: csv
    items:
      enum:
        - enclosingIpNetwork
        - latestObservationSnapshot
        - latestMapSnapshot
        - attributionReasons
        - annotation
      type: string

Why codegen includes all of them into request?
Am I missing something?

        qs: {
          limit: 'DATA GOES HERE',offset: 'DATA GOES HERE',ordering: 'id',businessUnits: '95cac2f2-cf70-4bb1-af1d-14f143fbfb3a',businessUnitNames: 'DATA GOES HERE',inet: 'DATA GOES HERE',tags: 'DATA GOES HERE',tagNames: 'DATA GOES HERE',optional_fields: 'DATA GOES HERE'
        },
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
          Authorization: process.env.JWT
        }
      },
      function(error, res, body) {
        if (error) return done(error);

        res.statusCode.should.equal(200);

        validator.validate(body, schema).should.be.true;
        done();
      });

Thanks in advance! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions