Skip to content

[scala-sttp] Fix enum is not imported correctly#10412

Merged
wing328 merged 1 commit intoOpenAPITools:masterfrom
bgong-mdsol:fix/enum-is-not-imported-correctly
Sep 17, 2021
Merged

[scala-sttp] Fix enum is not imported correctly#10412
wing328 merged 1 commit intoOpenAPITools:masterfrom
bgong-mdsol:fix/enum-is-not-imported-correctly

Conversation

@bgong-mdsol
Copy link
Contributor

This PR fixes the issue #8827

Here is the openapi spec that can be used to reproduce the issue and verify the fix. This spec includes the both inline and stand-alone Enum schemas.

openapi: 3.0.3
info:
 title: standalone or inline enums
 version: '1.0'
paths:
 /state:
   get:
     operationId: getUsers
     responses:
       '200':
         description: get Users
         content:
           application/json:
             schema:
               $ref: '#/components/schemas/Users'
components:
 schemas:
   Users:
     properties:
       emails:
         items:
           type: string
         type: array
       search:
         enum:
         - email
         - full_name
         type: string
       standAloneEnum:
         $ref: '#/components/schemas/StandAloneEnum'
   StandAloneEnum:
     enum:
       - first_name
       - last_name
       - email
     type: string

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (5.3.0)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@chameleon82 @clasnake @jimschubert @shijinkui @ramzimaalej @Bouillie @wing328 @jfeltesse-mdsol @jcarres-mdsol

@wing328
Copy link
Member

wing328 commented Sep 17, 2021

Thanks for the PR. Tested locally and the result is good with this fix:

williamcheng /tmp/scala (master) $ sbt compile
[info] welcome to sbt 1.5.0 (N/A Java 15.0.2)
[info] loading project definition from /private/tmp/scala/project
[info] loading settings for project scala from build.sbt ...
[info] set current project to openapi-client (in build file:/private/tmp/scala/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] compiling 5 Scala sources to /private/tmp/scala/target/scala-2.13/classes ...
[success] Total time: 9 s, completed 17 Sep 2021, 9:38:11 am

@wing328 wing328 merged commit fdb13c3 into OpenAPITools:master Sep 17, 2021
@wing328 wing328 added this to the 5.3.0 milestone Sep 17, 2021
@bgong-mdsol bgong-mdsol deleted the fix/enum-is-not-imported-correctly branch September 17, 2021 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants