Skip to content

[BUG] The filter for operationId does not trim the input #20186

@danielalmqvist

Description

@danielalmqvist

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

If you use filter of operationIds and configure this in OpenApiNormalizer in a plugin such as the one from maven you might want to use newlines to make it more readable, but this is not supported at the moment.

openapi-generator version

Latest 7.10.0

Generation Details

<openapiNormalizer> FILTER=operationId: addPet| getPetById </openapiNormalizer>

Steps to reproduce

Use openapiNormalizer and FILTER and set them on separate lines.
Expected the operationIdFilters to contain addPet and getPetById.
Actually the operationIdFilters contains addPet and \n\t\t\t\t\t\t\tgetPetById

Related issues/PRs

Not what I can find

Suggest a fix

Instead of
operationIdFilters = new HashSet<>(Arrays.asList(filterStrs[1].split("[|]")));
use
Arrays.stream(filterStrs[1].split("[|]")) .filter(Objects::nonNull) .map(String::trim) .collect(Collectors.toSet());

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions