-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[BUG][Elm] Generation crashes with Exception: Property type is missing from getVars #13571
Comments
Property type is missing from getVars
Property type is missing from getVars
I got the same error when generating crystal client for stripe api. Here's a minimal spec file that reproduces this error with latest master branch generating crystal client. The same spec works with v6.0.1. It seems like this bug was introduced by #13117. @spacether openapi: 3.0.0
info:
description: >-
This spec is mainly for testing Petstore server and contains fake endpoints,
models. Please do not use this for any other purpose. Special characters: "
\
version: 1.0.0
title: OpenAPI Petstore
license:
name: Apache-2.0
url: "https://www.apache.org/licenses/LICENSE-2.0.html"
tags:
- name: fake
paths:
/fake:
get:
tags:
- fake
operationId: fake
parameters:
- name: limit
in: query
required: false
schema:
type: integer
style: form
- name: scope
in: query
required: true
style: deepObject
explode: true
schema:
$ref: "#/components/schemas/scope_param"
responses:
"200":
description: The instance started successfully
content:
application/json:
schema:
type: object
additionalProperties: string
/fake2:
get:
tags:
- fake
operationId: fake2
parameters:
- name: scope
in: query
required: true
style: deepObject
explode: true
schema:
$ref: "#/components/schemas/scope_param"
responses:
"200":
description: The instance started successfully
content:
application/json:
schema:
type: object
additionalProperties: string
servers:
- url: https://localhost:8080/{version}
description: The local server
variables:
version:
enum:
- "v1"
- "v2"
default: "v2"
- url: https://127.0.0.1/no_variable
description: The local server without variables
components:
schemas:
scope_param:
type: object
title: scope_param
properties:
type:
enum: ["account", "user"]
type: "string"
user:
maxLength: 5000,
type: "string"
required: ["type"]
And the error I got is this:
|
Thank you for reporting this bug @Erudition and @cyangle
And the code in #13117 is looking for unmodified baseNames. @wing328 why was that change made in #8563? It looks like this code that modifies baseName was originally added in: |
The implementation in #8563 probably doesn't work with nested json objects. I think a model flattener is better than the current implementation. |
Stop mutating property.baseName
Just tried @cyangle 's workaround, it builds now! |
Agreed that the @Reinhard-PTV (author of #8563), for the following line:
can we store the value in vendorExtensions (e.g. x-deep-object-name) instead? |
Guys, Is there any workaround to this? I need to generate some Apex clients for Stripe API. |
See the messages before yours and you will see that yes, there is a workaround, and yes, I tried it and it works. But alas, we're still a long way from a usable Stripe API it seems. The generated code doesn't compile, and it's not trivial to fix, due to many remaining bugs in the Elm generator. I fixed hundreds of errors and gave up - they just keep coming. Distinct items named exactly the same, lists not closed, parameters missing altogether because their type is unsupported... the generator may be good as-is for simple APIs, but the Stripe API is too complex and uses too many OpenAPI features that are still broken in the Elm generator... |
reproduced here as well |
Bug Report Checklist
Description
The elm generator produces partial output and broken code before failing with this error:
openapi-generator version
6.2.0 (latest via npm)
OpenAPI declaration file content or url
https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json
Generation Details
Steps to reproduce
generate -i "https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json" -g elm -o elmStripeAPI
The text was updated successfully, but these errors were encountered: