Skip to content

REST service with optional parameter -> misp2 doesn't generate an additional empty option tag for select-box #8

Open
@aasaru

Description

@aasaru

I have a REST search service with optional header parameter of type enum:

        - in: header
          name: personType
          description: Filter by person type
          required: false
          schema:
            type: string
            enum: [INDIVIDUAL, LEGAL_ENTITY]

MISP2 generates the following SELECTbox out of this:

 <div class="field">
   <label>Filter by person type</label>
   <select name="personType" data-rf-param-location="header">
      <option value="INDIVIDUAL">INDIVIDUAL</option>
      <option value="LEGAL_ENTITY">LEGAL_ENTITY</option>
   </select>
 </div>

But Misp2 doesn't add empty option to the front (for the case if I don't want to specify anything).

The required behaviour would be that since the element is declared as required=false there should be an additional option tag in the front:

<div class="field">
    <label>Filter by person type</label>
    <select name="personType" data-rf-param-location="header">
      <option value="">--</option>
      <option value="INDIVIDUAL">INDIVIDUAL</option>
      <option value="LEGAL_ENTITY">LEGAL_ENTITY</option>
   </select>
 </div>

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