Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
Add a dry run as document (#891)
Browse files Browse the repository at this point in the history
* add a dry run as document

* refine README.md
  • Loading branch information
necusjz authored May 5, 2022
1 parent 1114a7b commit 27b54a4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 30 deletions.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,32 @@ Users can refer to [this document](https://github.com/Azure/azure-rest-api-specs

See [different combination of generation options](https://github.com/Azure/autorest.az/blob/master/doc/how-to-generate-with-different-options.md#most-useful-command-options-combination) for more useful scenarios.

If there is any error while code generation, please check [common errors while code generation](https://github.com/Azure/autorest.az/blob/master/doc/faq.md#common-errors-while-code-generation) for resolutions.
### Take logz extension as a dry run
It's always good to start with a command like that:
```text
$ autorest --version=3.0.6370 --az --use=@autorest/az@latest ../azure-rest-api-specs/specification/logz/resource-manager/readme.md --azure-cli-extension-folder=./azure-cli-extensions
```

Make sure you have these specific versions installed:

| AutoRest Core | AutoRest CLI | Node.js |
|:--------------:|:-------------:|:--------:|
| 3.0.6370 | 3.5.1 | 12.20 |

Errors you might encounter nowadays:
- ERROR: Schema violation: Additional properties not allowed: x-ms-identifiers
1. Append *--pass-thru:schema-validator-swagger* to the command;
- AttributeError: module 'mistune' has no attribute 'BlockGrammar'
1. Active the venv within *~/.autorest/@autorest_python@5.4.0/node_modules/@autorest/python*;
2. Execute *pip install mistune==0.8.4*;
- ImportError: cannot import name '_unicodefun' from 'click'
1. Active the venv within *~/.autorest/@autorest_az@1.8.0/node_modules/@autorest/az*;
2. Execute *pip install click==8.0.2*;

One more thing, it's a good practice to clean up AutoRest extensions by:
```text
$ autorest --reset
```

## Build the Generated Code
If you want to do a simple try, please go to the az-output-folder that you specified in your readme.az.md, build the wheel file and add the generated file into Azure CLI.
Expand Down
29 changes: 0 additions & 29 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,32 +450,3 @@ cli:
```
In this way. we can use `--param-name key1=value1,key2=value2 key1=valuea,key2=valueb` instead of `--param-name key1=value1 key2=value2 key1=valuea key2=valueb` to suggest that we want to input
two items (value1, value2) and (valuea, valueb).

## Common errors while code generation
The specific version information:

| AutoRest Core | AutoRest CLI | Node.js |
|:--------------:|:-------------:|:--------:|
| 3.0.6370 | 3.5.1 | 12.20 |

The path of Python virtual environment within "@autorest/python" extension should be like:
```text
~/.autorest/@autorest_python@xx/node_modules/@autorest/python/venv
```

> ModuleNotFoundError: No module named 'm2r'

1. Active the virtual environment within "@autorest/python";
2. Execute `pip install m2r`;

> AttributeError: module 'mistune' has no attribute 'BlockGrammar'

1. Active the virtual environment within "@autorest/python";
2. Execute `pip install mistune==0.8.4`;

> Failed to install or start extension '@autorest/az'

Specify the version of Node.js to **12.20** and the command should be like:
```text
$ autorest --version=3.0.6370 --az --use=@autorest/az@latest <path-to-the-swagger-readme.md> --azure-cli-extension-folder=<path-to-the-azure-cli-extension-repo>
```

0 comments on commit 27b54a4

Please sign in to comment.