Giter Site home page Giter Site logo

autorest.azure-functions's People

Contributors

ckittel avatar microsoft-github-policy-service[bot] avatar vrdmr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autorest.azure-functions's Issues

[Bug Report] Cannot generate python code with simple scaffold.

Troubleshooting:

  • Did you try autorest --reset and attempt again? Yes/No? Yes

Setup (please complete the following information): **

  • OS: Windows
  • OS Version: Windows 10
  • Mode: cli
  • Language to be generated: python
  • Autorest Core version: Please paste the output of autorest --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)

Describe the bug

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

To Reproduce

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

Click to expand the full stacktrace Process() cancelled due to exception : Cannot resolve pipeline stage 'openapi-document/identity'. / Error: Cannot resolve pipeline stage 'openapi-document/identity'. at resolvePipelineStageName (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\pipeline\pipeline.js:62:15) at C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\pipeline\pipeline.js:82:108 at Array.map () at createNodesAndSuffixes (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\pipeline\pipeline.js:82:97) at buildPipeline (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\pipeline\pipeline.js:132:9) at Object.runPipeline (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\pipeline\pipeline.js:228:22) at async processInternal (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\lib\autorest-core.js:120:17) at async currentMain (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\app.js:335:24) at async mainImpl (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\app.js:510:20) at async main (C:\Users\Mike\.autorest\@[email protected]\node_modules\@AutoREST\core\dist\app.js:537:20) Error: Cannot resolve pipeline stage 'openapi-document/identity'. [3.67 s] Shutting Down.

Additional context
Add any other context about the problem here.

Difference in generated code between VS code extension and autorest CLI

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.

[Bug Report] Duplicate object schemas with 'PayeeConfirmationStatus' name detected.

Troubleshooting:

  • Did you try autorest --reset and attempt again? Yes/No? YES

Setup (please complete the following information): **

  • OS: Windows
  • OS Version: Windows 10 Enterprise, 22H2 19045.2364
  • Mode: CLI
  • If VSCode, VSCode extension version:
  • Language to be generated: ? CSharp
  • Autorest Core version: Please paste the output of autorest --version if possible.
    AutoRest code generation utility [cli version: 3.6.3; node: v18.13.0]
    (C) 2018 Microsoft Corporation.
    https://aka.ms/autorest

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]

Describe the bug

ERROR (): Duplicate object schemas with 'PayeeConfirmationStatus' name detected.
There isnt any duplicate

To Reproduce

autorest --azure-functions-csharp --input-file:./openapi.json --output-folder:./generated-azfunctions --namespace:com.abrdn.fn --version:3.0.6320

Sample File attached
Stacktrace

Click to expand the full stacktrace

Additional context
Add any other context about the problem here.
openapi.docx
openapi.docx
openapi.docx

Support nullable properties

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.

TypeError: extension.updatePythonPath is not a function

Troubleshooting:

  • Did you try autorest --reset and attempt again? Yes/No?

Setup (please complete the following information): **

  • OS: Microsoft Windows 11 Home
  • OS Version: 10.0.22621 N/A Build 22621
  • Mode: Autorest on CLI
  • If VSCode, VSCode extension version: n/a
  • Language to be generated: ? Python
  • Autorest Core version:
    AutoRest code generation utility [cli version: 3.6.3; node: v18.16.0]
    (C) 2018 Microsoft Corporation.
    https://aka.ms/autorest

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]

Describe the bug

Unable to generate Azure Functions from Open API Specification using autorest with --azure-functions-python while --azure-functions-csharp works fine.

To Reproduce

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

[trace.log.log](https://github.com/Azure/autorest.azure-functions/files/11990295/trace.log.log) Click to expand the full stacktrace

Additional context
Add any other context about the problem here.

[Bug Report] Python scaffolding fails with ModuleNotFoundError: No module named 'm2r'

Troubleshooting:

  • Did you try autorest --reset and attempt again? Yes

Setup (please complete the following information): **

  • OS: Windows
  • OS Version: 21H2
  • Mode: VSCode
  • VSCode extension version:
  • Language to be generated: ? Python
  • Autorest Core version: (see table)
Type 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

Describe the bug

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).

To Reproduce

Prerequisites:

  • VSCode with the Azure Functions extension
  • autorest installed (npm install -g autorest)
  • folder opened in VSCode, with an empty file named test.json
  1. From the VSCode extension, Create new project > select folder > Python > HTTP trigger(s) from OpenAPI V2/V3 Specification (Preview)
  2. Select test.json as the file

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?

[Bug Report] OpenAPI's sample schema fails to generate for Typescript and C#

Setup (please complete the following information): **

  • OS: Windows
  • OS Version: [e.g. Ubuntu 1604, macOS 10.15, ...]
  • Mode: autorest CLI
  • Language to be generated: Typescript, CSharp
  • Autorest Core version: 3.0.6320

Describe the bug

Typescript: Error: multipart forms not implemented yet
C#: System.InvalidOperationException: Constant type mismatch. value: https://petstore.swagger.io/v2

To Reproduce

  1. Get the "getting started" schema (Swagger Pet Store) from https://editor.swagger.io/
  2. Generate for Typescript and C#.
  3. Observe failures above.
  4. Generate for Python
  5. Success.

Additional context
The MVP of functionality should be successfully generating an API from the standard page for getting started with Swagger/OpenAPI.

azure-functions-csharp - TypeError: request.UpdateSignatureParameters is not a function

Troubleshooting:

  • Did you try autorest --reset and attempt again? Yes/No? Yes

Setup (please complete the following information): **

  • OS: [e.g. macOS, Windows, Linux] : Windows
  • OS Version: [e.g. Ubuntu 1604, macOS 10.15, ...] : Windows 10
  • Mode: [VSCode or Autorest on CLI]: Autorest on CLI
  • If VSCode, VSCode extension version:
  • Language to be generated: ? Csharp
  • Autorest Core version: Please paste the output of autorest --version if possible. 3.0.6320

Describe the bug

Getting error while generating csharp code for Azure Functions for the openAPI defination given as input.

To Reproduce

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

Click to expand the full stacktrace FATAL: TypeError: request.updateSignatureParameters is not a function Error: Plugin grouper reported failure.

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.