Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle untyped schemas (in some languages) #1078

Conversation

gibson042
Copy link

Ref swagger-api/swagger-codegen#6898
Ref swagger-api/swagger-codegen#6896

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.3.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Partial copy of swagger-api/swagger-codegen#6898 (for handling untyped schemas, especially as additionalProperties), at the request of @wing328 . This has not yet been tested, nor have tests been updated, nor are all languages covered.

@wing328
Copy link
Member

wing328 commented Sep 21, 2018

Thanks @gibson042 . We'll run some tests and let you know if we've any feedback/question. Have a nice weekend.

@wing328
Copy link
Member

wing328 commented Nov 4, 2018

@gibson042 I ran some tests but couldn't repeat the issue with the OpenAPI Generator. Here is what I got from C# client:

        /// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Dictionary&lt;string, Object&gt;</returns>
        Dictionary<string, Object> MapOfAnything ();

Spec:

swagger: '2.0'
info:
  title: 'map of arbitrary values'
  version: '1'
produces: ["application/json"]
paths:
  /mapOfAnything:
    get:
      operationId: mapOfAnything
      responses:
        default:
          schema:
            description: 'map of arbitrary values'
            type: object
            additionalProperties:
              description: Any JSON type

I wonder if you can test with OpenAPI Generator and see if it also works for you without the PR.

@gibson042
Copy link
Author

I can't get a successful build at the moment, but I can tell you that the issue was originally discovered in Java... what code is produced in that language by each relevant version of OpenAPI Generator?

@wing328
Copy link
Member

wing328 commented Nov 5, 2018

That's ok. I plan to add better handling of free-form object via #1338. Stay tuned.

@wing328
Copy link
Member

wing328 commented Jan 5, 2019

@gibson042 #1338 has been merged into master. Please give it another try when you've time.

Closing this PR for the time being.

Happy New Year!

@wing328 wing328 closed this Jan 5, 2019
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