Skip to content

[ELM] Functions generated from operationId can have invalid names #8070

@abingham

Description

@abingham
Description

The operationId field of paths can have values which are not valid Elm identifiers. It seems that these values are used unmodified to produce Elm function names, meaning that the generator produces invalid Elm code.

This happens, for example, when operationId values contain "."s, as is common when using connexion.

openapi-generator version

Latest. Not sure.

Swagger declaration file content or url
basePath: /
consumes:
- application/json
info:
  description: An API
  title: An API
  version: '1.0'
paths:
  /:
    get:
      operationId: get.foo.bar
      responses:
        '200':
          description: Success
produces:
- application/json
swagger: '2.0'
Command line used for generation

openapi-generator generate -i broken.yaml -l elm -o gen

Steps to reproduce
  1. Put the above YAML into broken.yaml
  2. Run the command above
Suggest a fix/enhancement

At least for my purposes, replacing '.' with '_' in the function names would do the trick. There may be more characters in valid operationId's which are invalid in Elm identifiers, though, so someone who knows the spec should find all translations that need to happen.

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