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

[BUG] Code formatting failed. #613

Closed
vadimlukutin opened this issue May 24, 2023 · 9 comments · Fixed by #617
Closed

[BUG] Code formatting failed. #613

vadimlukutin opened this issue May 24, 2023 · 9 comments · Fixed by #617
Assignees
Labels
bug Something isn't working Triage needed

Comments

@vadimlukutin
Copy link

I have Open API json code. Validate on JSON on app.swaggerhub.com.

But have error:

[WARNING] swagger_dart_code_generator on assets/swaggers/organisation_api_docs.json:
[WARNING] Code formatting failed.
Please raise an issue on https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/
Reason: Could not format because the source could not be parsed:

line 9283, column 8 of .: Expected an identifier.

9283 │ this.,
│ ^

line 9296, column 8 of .: Expected to find ';'.

9296 │ final InventoryProductidwriteOff? ;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^

line 9296, column 34 of .: Operator declarations must be preceded by the keyword 'operator'.

9296 │ final InventoryProductidwriteOff? ;
│ ^

line 9296, column 34 of .: The string '?' isn't a user-definable operator.

9296 │ final InventoryProductidwriteOff? ;
│ ^

line 9296, column 34 of .: Methods must have an explicit list of parameters.

9296 │ final InventoryProductidwriteOff? ;
│ ^

line 9458, column 8 of .: Expected an identifier.

9458 │ this.,
│ ^

line 9471, column 8 of .: Expected to find ';'.

9471 │ final InventoryidbulkProcessing? ;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^

line 9471, column 33 of .: Operator declarations must be preceded by the keyword 'operator'.

9471 │ final InventoryidbulkProcessing? ;
│ ^

line 9471, column 33 of .: The string '?' isn't a user-definable operator.

9471 │ final InventoryidbulkProcessing? ;
│ ^

line 9471, column 33 of .: Methods must have an explicit list of parameters.

9471 │ final InventoryidbulkProcessing? ;
│ ^

(5 more errors...)
[INFO] 4.4s elapsed, 0/2 actions completed.
[INFO] 5.9s elapsed, 2/3 actions completed.
[INFO] Running build completed, took 6.4s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 41ms

[SEVERE] freezed on lib/src/data/repositories/api/organisation_api_docs.swagger.dart (cached):

This builder requires Dart inputs without syntax errors.
However, package:balance3d/src/data/repositories/api/organisation_api_docs.swagger.dart (or an existing part) contains the following errors.
organisation_api_docs.swagger.dart:9283:8: Expected an identifier.
organisation_api_docs.swagger.dart:9296:8: Expected to find ';'.
organisation_api_docs.swagger.dart:9296:34: Operator declarations must be preceded by the keyword 'operator'.
And 12 more...

Try fixing the errors and re-running the build.

[SEVERE] json_serializable on lib/src/data/repositories/api/root_api_docs.swagger.dart (cached):

UnimplementedError: (InvalidTypeImpl) InvalidType
[SEVERE] json_serializable on lib/src/data/repositories/api/organisation_api_docs.swagger.dart (cached):

This builder requires Dart inputs without syntax errors.
However, package:balance3d/src/data/repositories/api/organisation_api_docs.swagger.dart (or an existing part) contains the following errors.
organisation_api_docs.swagger.dart:9283:8: Expected an identifier.
organisation_api_docs.swagger.dart:9296:8: Expected to find ';'.
organisation_api_docs.swagger.dart:9296:34: Operator declarations must be preceded by the keyword 'operator'.
And 12 more...

Try fixing the errors and re-running the build.

[SEVERE] chopper_generator on lib/src/data/repositories/api/organisation_api_docs.swagger.dart (cached):

This builder requires Dart inputs without syntax errors.
However, package:balance3d/src/data/repositories/api/organisation_api_docs.swagger.dart (or an existing part) contains the following errors.
organisation_api_docs.swagger.dart:9283:8: Expected an identifier.
organisation_api_docs.swagger.dart:9296:8: Expected to find ';'.
organisation_api_docs.swagger.dart:9296:34: Operator declarations must be preceded by the keyword 'operator'.
And 12 more...

Try fixing the errors and re-running the build.

[SEVERE] Failed after 6.5s

@vadimlukutin
Copy link
Author

"/inventory/{id}/bulk_processing": { "post": { "tags": [ "Inventories" ], "summary": "Массовое оприходование и списание продуктов инвентаризации", "operationId": "07db75d149ddfc448e2857193721894d", "parameters": [ { "name": "id", "in": "path", "required": true, "style": "simple", "explode": false, "schema": { "type": "integer" } } ], "requestBody": { "description": "", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/id_bulk_processing_body" } } }, "required": true }, "responses": { "200": { "description": "Successful operation", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Inventory" } } } } }, "401": { "description": "Unauthenticated" }, "403": { "description": "Not permitted" } }, "security": [ { "bearerAuth": [] } ] } },

@vadimlukutin
Copy link
Author

After remove Error scheme from allOf. Have build error. And missing generate part 'root_api_docs.swagger.g.dart';.

[INFO] Running build...
[INFO] 11.0s elapsed, 0/2 actions completed.
[INFO] 14.6s elapsed, 0/2 actions completed.
[INFO] 16.0s elapsed, 2/3 actions completed.
[SEVERE] json_serializable on lib/src/data/repositories/api/root_api_docs.swagger.dart:

UnimplementedError: (InvalidTypeImpl) InvalidType
[INFO] 17.8s elapsed, 3/4 actions completed.
[INFO] 18.8s elapsed, 5/6 actions completed.
[INFO] Running build completed, took 19.0s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 44ms

[SEVERE] Failed after 19.0s

            "Error": {
                "properties": {
                    "status": {
                        "type": "integer",
                        "example": "422"
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "properties": {
                            "any_field_name": {
                                "type": "array",
                                "items": {
                                    "type": "string"
                                }
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },

@vadimlukutin
Copy link
Author

Ok I check trouble. Error appear when '"allOf"' contain more one items.

@vadimlukutin
Copy link
Author

vadimlukutin commented May 26, 2023

Again I have test. And error appear when allOf have properties on items. If have some items only with "$ref" codegenerate is successfull.

"UserWithRoles": {
                "type": "object",
                "allOf": [
                    {
                        "$ref": "#/components/schemas/UserWithRole"
                    },
                    {
                        "$ref": "#/components/schemas/User"
                    }
                ]
            }

@fryette
Copy link
Contributor

fryette commented May 29, 2023

@Vovanella95 could you please take a look?

@Vovanella95
Copy link
Collaborator

@vadimlukutin I will take a look

@Vovanella95
Copy link
Collaborator

@vadimlukutin Could you please share swagger file, when issue is reproduced? You can do it in private channel
vovanella95@mail.ru

@vadimlukutin
Copy link
Author

ok

@vadimlukutin
Copy link
Author

@Vovanella95 I was send to email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Triage needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants