azure / autorest.azure-functions Goto Github PK
View Code? Open in Web Editor NEWCode Generation for Azure Functions
License: MIT License
Code Generation for Azure Functions
License: MIT License
Troubleshooting:
autorest --reset
and attempt again? Yes/No? Yesautorest --version
if possible.AutoRest code generation utility [cli version: 3.1.2; node: v12.21.0, max-memory: 2048 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Failure:
Error: Unable to find a valid AutoRest core package '@autorest/core' @ 'true'.
Error: Unable to find a valid AutoRest core package '@autorest/core' @ 'true'.
at Object.selectVersion (C:\Users\Mike\AppData\Roaming\npm\node_modules\autorest\dist\src_autorest-as-a-service_ts-src_coloring_ts.js:303:23)
A clear and concise description of what the bug is.
Trying to generate a function scaffold via:
autorest --input-file=test.yaml --python --azure-functions-python --no-namespace-folders:true --debug --version:3.0.6320 --output-folder:./generated-azfunctions
Yields the error:
Process() cancelled due to exception : Cannot resolve pipeline stage 'openapi-document/identity'. / Error: Cannot resolve pipeline stage 'openapi-document/identity'.
test.yaml:
openapi: 3.0.0
info:
version: 1.0.0
title: Sample API
description: A sample API to illustrate OpenAPI concepts
paths:
/list:
get:
description: Returns a list of stuff
responses:
'200':
description: Successful response
autorest --input-file=test.yaml --python --azure-functions-python --no-namespace-folders:true --debug --version:3.0.6320 --output-folder:./generated-azfunctions
AutoRest code generation utility [cli version: 3.1.2; node: v12.21.0, max-memory: 2048 MB]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
Network Enabled: true
Starting @autorest/core from C:\Users\Mike\.autorest\@[email protected]
Loading AutoRest core 'C:\Users\Mike\.autorest\@[email protected]\node_modules\@autorest\core\dist' (3.0.6320)
Loading AutoRest extension '@microsoft.azure/autorest.python' (~3.0.56->3.0.62)
Loading AutoRest extension '@autorest/azure-functions-python' (latest->0.1.0-preview)
Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)
Loading AutoRest extension '@microsoft.azure/autorest.modeler' (2.3.44->2.3.44)
Process() cancelled due to exception : Cannot resolve pipeline stage 'openapi-document/identity'. / Error: Cannot resolve pipeline stage 'openapi-document/identity'.
Trying to generate
Sample File attached
test.yaml
openapi: 3.0.0
info:
version: 1.0.0
title: Sample API
description: A sample API to illustrate OpenAPI concepts
paths:
/list:
get:
description: Returns a list of stuff
responses:
'200':
description: Successful response
Stacktrace
Additional context
Add any other context about the problem here.
Not sure if this the right place to report this, but when I generated C# from the Azure Functions VS code extension, it set the TargetFramework to netcoreapp2.1 in the csproj, which causes "error CS8370: Feature 'nullable reference types' is not available in C# 7.3. Please use language version 8.0 or greater" on build because of the "#nullable disable" in each .cs file in the Models folder.
When I ran autorest directly (autorest --azure-functions-csharp --input-file:spec.json --output-folder:./generated-azfunctions --version:3.0.6314 --namespace:CovidScreeningNamespace), the TargetFramework was netcoreapp3.1 and it built successfully.
Check https://github.com/Azure/project-stencil/blob/master/package.json file and make sure it is ready for Stencil and not for autorest.python
Troubleshooting:
autorest --reset
and attempt again? Yes/No? YESautorest --version
if possible.Showing All Installed Extensions
Type Extension Name Version Location
extension @autorest/azure-functions-csharp 0.2.0-preview-dev.321054549 C:\Users\john.mcrobb.autorest@[email protected]
core @autorest/core 3.0.6320 C:\Users\john.mcrobb.autorest@[email protected]
extension @autorest/modelerfour 4.15.414 C:\Users\john.mcrobb.autorest@[email protected]
ERROR (): Duplicate object schemas with 'PayeeConfirmationStatus' name detected.
There isnt any duplicate
autorest --azure-functions-csharp --input-file:./openapi.json --output-folder:./generated-azfunctions --namespace:com.abrdn.fn --version:3.0.6320
Sample File attached
Stacktrace
Additional context
Add any other context about the problem here.
openapi.docx
openapi.docx
openapi.docx
I am trying to generate Function app from swagger definition. Function App gets generated but with version v2 and gives "nullable reference types". Due to which I have to manually go and add in project file C# 8.0 nullable option else compile time issue.
Same if I try using Visual studio project Azure function creates with v3.
autorest: 3.2.0
azure function vscode extension: 1.4.0
OpenAPI spec 3.0.3 specifies the nullable attribute on a property swagger When running the Create Azure Function command in VSCode it does not seem to specify this attribute in the data model. I have tried running it in a Python and Typescript project. In Python when serializing an msrest.serialization.model
object this results in losing the passed null
value in the request. In Typescript the Composite Mapper type seems to support the nullable attribute docs but the attribute is not present in mappers.ts
when creating the azure function.
Troubleshooting:
autorest --reset
and attempt again? Yes/No?Showing All Installed Extensions
Type Extension Name Version Location
extension @autorest/azure-functions-csharp 0.2.0-preview-dev.321054549 C:\Users\flefe.autorest@[email protected]
extension @autorest/azure-functions-python 0.1.0-preview C:\Users\flefe.autorest@[email protected]
extension @autorest/azure-functions-typescript 0.0.1-preview C:\Users\flefe.autorest@[email protected]
core @autorest/core 3.0.6320 C:\Users\flefe.autorest@[email protected]
core @autorest/core 3.9.6 C:\Users\flefe.autorest@[email protected]
extension @autorest/modelerfour 4.15.396 C:\Users\flefe.autorest@[email protected]
extension @autorest/modelerfour 4.15.414 C:\Users\flefe.autorest@[email protected]
Unable to generate Azure Functions from Open API Specification using autorest with --azure-functions-python while --azure-functions-csharp works fine.
autorest --azure-functions-python --input-file:petstore.json --output-folder:./generated-azfunctions --no-namespace-folders:true --version:3.0.6320 --verbose
Sample File attached
petstore.zip
Stacktrace
Additional context
Add any other context about the problem here.
Troubleshooting:
autorest --reset
and attempt again? YesType | Extension Name | Version |
---|---|---|
extension | @autorest/azure-functions-python | 0.1.0-preview |
core | @autorest/core | 3.0.6320 |
core | @autorest/core | 3.8.3 |
extension | @autorest/modelerfour | 4.15.414 |
When attempting to scaffold a project using the VSCode extension (Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
), the process fails with the following error:
10:32:13 AM: Running command: "autorest --input-file:"c:\development\test\example_OpenAPIv3.json" --version:3.0.6320 --azure-functions-python --no-namespace-folders:True --no-async --generate-metadata:false --output-folder:"c:\development\test""...
AutoRest code generation utility [cli version: 3.6.1; node: v17.8.0]
(C) 2018 Microsoft Corporation.
https://aka.ms/autorest
info | AutoRest core version selected from configuration: 3.0.6320.
Loading AutoRest core 'C:\Users%USER%.autorest@[email protected]\nodemodules@autorest\core\dist' (3.0.6320)
Loading AutoRest extension '@autorest/azure-functions-python' (latest->0.1.0-preview)
Loading AutoRest extension '@autorest/modelerfour' (4.15.414->4.15.414)
WARNING (PreCheck/CheckDuplicateSchemas): Checking for duplicate schemas, this could take a (long) while. Run with --verbose for more detail.
API Exception: {'type': 'ModuleNotFoundError', 'args': ("No module named 'm2r'",), 'message': "No module named 'm2r'"}
Traceback (most recent call last):
File "C:\Users%USER%.autorest@[email protected]\node_modules@autorest\azure-functions-python\venv\lib\site-packages\jsonrpc\manager.py", line 113, in get_responses
result = method(*request.args, **request.kwargs)
File "C:\Users%USER%.autorest@[email protected]\node_modules@autorest\azure-functions-python\autorest\jsonrpc\server.py", line 34, in Process
from ..m2r import M2R as PluginToLoad
File "C:\Users%USER%.autorest@[email protected]\node_modules@autorest\azure-functions-python\autorest\m2r_init.py", line 11, in
import m2r
ModuleNotFoundError: No module named 'm2r'
Error: Server error
10:32:17 AM: Error: Failed to run "autorest" command. Check output window for more details.
Strongly suspect this is due to one of the dependencies--or rather, dependencies' dependency mistune
--having a breaking change when it went from 0.8.4 to 2.0.x. The Common Errors section of the autorest.az FAQ was invaluable in figuring out the workaround (see Additional Context below for the workaround).
Prerequisites:
npm install -g autorest
)test.json
Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
Error will be reproduced as described above.
Additional context
Was able to resolve the issue by activating the autorest venv and installing a pinned version of mistune, then also installing the other dependencies it blocked.
C:\Users\%USER%\.autorest\@autorest_azure-functions-python@0.1.0-preview\node_modules\@autorest\azure-functions-python\venv\Scripts\activate
pip install mistune==0.8.4
pip install m2r
pip install jinja2
Once those steps are taken, it works fine. Perhaps pinning the mistune version within autorest would resolve for future users?
Look at Autorest.TestServer to add.
Typescript: Error: multipart forms not implemented yet
C#: System.InvalidOperationException: Constant type mismatch. value: https://petstore.swagger.io/v2
Additional context
The MVP of functionality should be successfully generating an API from the standard page for getting started with Swagger/OpenAPI.
There are important files that Microsoft projects should all have that are not present in this repository. A pull request has been opened to add the missing file(s). When the pr is merged this issue will be closed automatically.
Microsoft teams can learn more about this effort and share feedback within the open source guidance available internally.
Troubleshooting:
autorest --reset
and attempt again? Yes/No? Yesautorest --version
if possible. 3.0.6320Getting error while generating csharp code for Azure Functions for the openAPI defination given as input.
Run autorest command -
autorest --azure-functions-csharp --input-file:./Source/petstore-expanded.json --output-folder:./Generated --namespace:SampleApi.PetStore --version:3.0.6320 --verbose
Sample File attached
Refer this file as input.
https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v2.0/json/petstore-expanded.json
Stacktrace
FATAL: TypeError: request.updateSignatureParameters is not a function
Additional context
Add any other context about the problem here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.