Skip to content

Commit

Permalink
Fix: Loading 'python' nested config (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin authored Mar 1, 2021
1 parent 3182e25 commit f6f36ba
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 44 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additio
pass-thru:
- model-deduplicator
- subset-reducer
version: ^3.0.6372
version: ^3.1.0
use-extension:
"@autorest/modelerfour": ^4.15.456

Expand Down Expand Up @@ -58,18 +58,12 @@ modelerfour:

pipeline:
python:
# doesn't process anything, just makes it so that the 'python:' config section loads early.
# Doesn't process anything, just makes it so that the 'python:' config section is loaded and available for the next plugins.
pass-thru: true
input: openapi-document/multi-api/identity

modelerfour:
# in order that the modelerfour/flattener/grouper/etc picks up
# configuration nested under python: in the user's config,
# we have to make modeler four pull from the 'python' task.
input: python
input: modelerfour/identity

python/m2r:
input: modelerfour/identity
input: python

python/namer:
input: python/m2r
Expand Down
30 changes: 15 additions & 15 deletions docs/generate/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ These directives all start out with this general skeleton of a directive:
````
```yaml
directive:
from: swagger-document
where: ...
transform: ...
- from: swagger-document
where: ...
transform: ...
```
````

Expand Down Expand Up @@ -42,9 +42,9 @@ We use `$["x-python-custom-poller-sync"]` and `$["x-python-custom-poller-async"]

```yaml
directive:
from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
- from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
$["x-python-custom-poller-sync"] = "my.library.CustomPoller";
$["x-python-custom-poller-async"] = "my.library.aio.AsyncCustomPoller"
```
Expand Down Expand Up @@ -72,9 +72,9 @@ We use `$["x-python-custom-default-polling-method-sync"]` and `$["x-python-custo

```yaml
directive:
from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
- from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
$["x-python-custom-default-polling-method-sync"] = "my.library.CustomDefaultPollingMethod";
$["x-python-custom-default-polling-method-async"] = "my.library.aio.AsyncCustomDefaultPollingMethod"
```
Expand All @@ -101,9 +101,9 @@ We use `$["x-python-custom-pager-sync"]` and `$["x-python-custom-pager-async"]`

```yaml
directive:
from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
- from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-pager-sync"] = "my.library.CustomPager";
$["x-python-custom-pager-async"] = "my.library.aio.AsyncCustomPager"
```
Expand All @@ -130,9 +130,9 @@ We use `$["x-python-custom-default-paging-method]` to specify our default pagin

```yaml
directive:
from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
- from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-default-paging-method"] = "my.library.CustomDefaultPagingMethod";
```

Expand Down
24 changes: 12 additions & 12 deletions docs/samples/specification/directives/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ clear-output-folder: true
```yaml
directive:
from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
- from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
$["x-python-custom-poller-sync"] = "my.library.CustomPoller";
$["x-python-custom-poller-async"] = "my.library.aio.AsyncCustomPoller"
```
Expand All @@ -27,9 +27,9 @@ directive:
```yaml
directive:
from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
- from: swagger-document
where: '$.paths["/basic/polling"].put'
transform: >
$["x-python-custom-default-polling-method-sync"] = "my.library.CustomDefaultPollingMethod";
$["x-python-custom-default-polling-method-async"] = "my.library.aio.AsyncCustomDefaultPollingMethod"
```
Expand All @@ -39,9 +39,9 @@ directive:
```yaml
directive:
from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
- from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-pager-sync"] = "my.library.CustomPager";
$["x-python-custom-pager-async"] = "my.library.aio.AsyncCustomPager"
```
Expand All @@ -50,8 +50,8 @@ directive:
```yaml
directive:
from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
- from: swagger-document
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-default-paging-method"] = "my.library.CustomDefaultPagingMethod";
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/autorestv3/README.md",
"dependencies": {
"@azure-tools/extension": "^3.0.249"
"@azure-tools/extension": "~3.2.1"
},
"devDependencies": {
"@autorest/autorest": "^3.0.0",
Expand Down
12 changes: 6 additions & 6 deletions test/azure/specification/custompollerpager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ clear-output-folder: true
### Override ItemPaged to custom Pager
``` yaml
directive:
from: swagger-document
where: '$.paths["/paging/single"].get'
transform: >
- from: swagger-document
where: '$.paths["/paging/single"].get'
transform: >
$["x-python-custom-pager-sync"] = "custompollerpagerdefinitions.CustomPager";
$["x-python-custom-pager-async"] = "custompollerpagerdefinitions.aio.AsyncCustomPager"
```
### Override LROPoller to custom Poller
``` yaml
directive:
from: swagger-document
where: '$.paths["/paging/multiple/lro"].post'
transform: >
- from: swagger-document
where: '$.paths["/paging/multiple/lro"].post'
transform: >
$["x-python-custom-poller-sync"] = "custompollerpagerdefinitions.CustomPoller";
$["x-python-custom-poller-async"] = "custompollerpagerdefinitions.aio.AsyncCustomPoller"
```

0 comments on commit f6f36ba

Please sign in to comment.