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

fix links #863

Merged
merged 1 commit into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generating with Autorest for Python v5.0.0

See [here](https://github.com/Azure/autorest.python/wiki/Generating-with-autorest-for-python-v5.0.0)
See [here](https://github.com/Azure/autorest.python/wiki/Generating-with-autorest-for-python-v5.0.0) for Python-specific docs, and [here] for general docs

# Contributing

Expand Down Expand Up @@ -131,3 +131,7 @@ scope-black/emitter:

output-artifact: python-files
```

<!-- LINKS -->
[python_docs]: https://github.com/Azure/autorest.python/tree/autorestv3/docs/readme.md
[main_docs]: https://github.com/Azure/autorest/tree/master/docs
2 changes: 1 addition & 1 deletion docs/client/initializing.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ client = PetsClient(credential=DefaultAzureCredential(), api_version="v1")
```

<!-- LINKS -->
[multiapi_generation]: ../generate/multiapi.md
[multiapi_generation]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/multiapi.md
[azure_core_library]: https://pypi.org/project/azure-core/
[msrest_library]: https://pypi.org/project/msrest/
[azure_mgmt_core_library]: https://pypi.org/project/azure-mgmt-core/
Expand Down
2 changes: 1 addition & 1 deletion docs/client/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ v3_models = client.models(api_version='3.0.0')
```

<!-- LINKS -->
[models_ex]: ../samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py#L91
[models_ex]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/multiapi/generated/azure/multiapi/sample/_multiapi_service_client.py#L91
8 changes: 4 additions & 4 deletions docs/client/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ a pager that pages through the final lists of data.
[operation_group_example]: https://github.com/Azure/azure-rest-api-specs/blob/master/specification/batch/data-plane/Microsoft.Batch/stable/2020-09-01.12.0/BatchService.json#L64
[mixin_example]: https://github.com/Azure/autorest/blob/master/docs/openapi/examples/pets.json#L20
[pets_swagger]: https://github.com/Azure/autorest/blob/master/docs/openapi/examples/pets.json
[initializing]: ./initializing.md
[initializing]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/initializing.md
[lro_poller]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.lropoller?view=azure-python
[custom_poller]: ../generate/directives.md#generate-with-a-custom-poller
[example_swagger]: ../samples/specification/directives/pollingPaging.json
[custom_poller]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/directives.md#generate-with-a-custom-poller
[example_swagger]: https://github.com/Azure/autorest/blob/master/docs/openapi/examples/pollingPaging.json
[poller_guidelines]: https://azure.github.io/azure-sdk/python_design.html#service-operations
[async_lro_poller]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.asynclropoller?view=azure-python
[item_paged]: https://docs.microsoft.com/python/api/azure-core/azure.core.paging.itempaged?view=azure-python
[custom_pager]: ../generate/directives.md#generate-with-a-custom-pager
[custom_pager]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/directives.md#generate-with-a-custom-pager
[async_item_paged]: https://docs.microsoft.com/python/api/azure-core/azure.core.async_paging.asyncitempaged?view=azure-python
10 changes: 5 additions & 5 deletions docs/client/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ After [generating][generate] your client, this section tells you how to actually

<!-- LINKS -->
[generate]: https://github.com/Azure/autorest/tree/master/docs/generate/readme.md
[initializing]: ./initializing.md
[operations]: ./operations.md
[models]: ./models.md
[troubleshooting]: ./troubleshooting.md
[tracing]: ./tracing.md
[initializing]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/initializing.md
[operations]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/operations.md
[models]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/models.md
[troubleshooting]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/troubleshooting.md
[tracing]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/tracing.md
6 changes: 6 additions & 0 deletions docs/developer/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# <img align="center" src="../images/logo.png"> Developing and Contributing to Python AutoRest

Docs will be added. See the [main docs][main_docs] for some information.

<!-- LINKS -->
[main_docs]: https://github.com/Azure/autorest/blob/master/docs/developer/readme.md
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@


<!-- LINKS -->
[min_dependencies]: ./client/initializing.md#minimum-dependencies-of-your-client
[min_dependencies]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/initializing.md#minimum-dependencies-of-your-client
[autorest_npm]: https://www.npmjs.com/package/@autorest/python
22 changes: 11 additions & 11 deletions docs/generate/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ directive:
````

Additionally, they all require you to specify which operation you would like to modify. You refer to operation using it's path in the swagger, and the HTTP verb it's listed under.
So, if you were modifying the `put` operation under the path `/directives/polling`, your `where` part of the directive would look like `where: '$.paths["/directives/polling"].put'`
So, if you were modifying the `put` operation under the path `/basic/polling`, your `where` part of the directive would look like `where: '$.paths["/basic/polling"].put'`

Where they differ is in the conditions your custom objects need to fulfill, how you mark the directive, and how they change the generated code.

Expand All @@ -24,7 +24,7 @@ The following scenarios all use the [pollingPaging.json][polling_paging_swagger]
* [Generate with a Custom Poller](#generate-with-a-custom-poller "Generate with a Custom Poller")
* [Generate with a Custom Default Polling Method](#generate-with-a-custom-default-polling-method "Generate with a Custom Default Polling Method")
* [Generate with a Custom Pager](#generate-with-a-custom-pager "Generate with a Custom Pager")
* [Generate with a Custom Paging Method](#generate-with-a-custom-paging-method "Generate with a Custom Paging Method")
* [Generate with a Custom Default Paging Method](#generate-with-a-custom-default-paging-method "Generate with a Custom Default Paging Method")

## Generate with a Custom Poller

Expand All @@ -36,14 +36,14 @@ By default, a long running operation will generate with poller [`LROPoller`][lro
2. The initialization parameters must be the same as [`LROPoller`][lro_poller_docs]'s
3. If you want continuation token support on your poller, you need to implement class method `from_continuation_token` with the same method signature as [`LROPoller`][lro_poller_docs]'s

We will be modifying the long running operation in the [example swagger][polling_paging_swagger], so the `where` in our directive will be `where: '$.paths["/directives/polling"].put'`
We will be modifying the long running operation in the [example swagger][polling_paging_swagger], so the `where` in our directive will be `where: '$.paths["/basic/polling"].put'`

We use `$["x-python-custom-poller-sync"]` and `$["x-python-custom-poller-async"]` to specify our sync and async custom pollers. You have to use the full import path of the custom poller you're specifying, i.e. `my.library.CustomPoller`. Putting this altogether, we get the following directive, which we will insert in our config file.

```yaml
directive:
from: swagger-document
where: '$.paths["/directives/polling"].put'
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 @@ -73,7 +73,7 @@ We use `$["x-python-custom-default-polling-method-sync"]` and `$["x-python-custo
```yaml
directive:
from: swagger-document
where: '$.paths["/directives/polling"].put'
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 @@ -95,14 +95,14 @@ By default, a paging operation will generate with pager [`ItemPaged`][item_paged

1. Your custom pager must have the same initialization parameters as [`ItemPaged`][item_paged_docs]

We will be modifying the paging operation in the [example swagger][polling_paging_swagger], so the `where` in our directive will be `where: '$.paths["/directives/paging"].get'`
We will be modifying the paging operation in the [example swagger][polling_paging_swagger], so the `where` in our directive will be `where: '$.paths["/basic/paging"].get'`

We use `$["x-python-custom-pager-sync"]` and `$["x-python-custom-pager-async"]` to specify our sync and async custom pagers. You have to use the full import path of the custom pager you're specifying, i.e. `my.library.CustomPager`. Putting this altogether, we get the following directive, which we will insert in our config file.

```yaml
directive:
from: swagger-document
where: '$.paths["/directives/paging"].get'
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-pager-sync"] = "my.library.CustomPager";
$["x-python-custom-pager-async"] = "my.library.aio.AsyncCustomPager"
Expand Down Expand Up @@ -131,7 +131,7 @@ We use `$["x-python-custom-default-paging-method]` to specify our default pagin
```yaml
directive:
from: swagger-document
where: '$.paths["/directives/paging"].get'
where: '$.paths["/basic/paging"].get'
transform: >
$["x-python-custom-default-paging-method"] = "my.library.CustomDefaultPagingMethod";
```
Expand All @@ -145,14 +145,14 @@ Here is the before and after of the generated code.
# <img align="center" src="../images/after_paging_method_directive.png">


For a full multiapi config example, see our [sample][sample_directives]
For a full directives config example, see our [sample][sample_directives]

<!-- LINKS -->
[main_docs]: https://github.com/Azure/autorest/tree/master/docs/generate/directives.md
[lro_poller_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.lropoller?view=azure-python
[azure_core_pypi]: https://pypi.org/project/azure-core/
[async_lro_poller_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.asynclropoller?view=azure-python
[polling_paging_swagger]: ../samples/specification/directives/pollingPaging.json
[polling_paging_swagger]: https://github.com/Azure/autorest/blob/master/docs/openapi/examples/pollingPaging.json

[lro_base_polling_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.base_polling.lrobasepolling?view=azure-python
[async_lro_base_polling_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.polling.async_base_polling.asynclrobasepolling?view=azure-python
Expand All @@ -163,4 +163,4 @@ For a full multiapi config example, see our [sample][sample_directives]

[item_paged_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.paging.itempaged?view=azure-python
[async_item_paged_docs]: https://docs.microsoft.com/python/api/azure-core/azure.core.async_paging.asyncitempaged?view=azure-python
[sample_directives]: ../samples/specification/directives/readme.md
[sample_directives]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/directives/readme.md
4 changes: 2 additions & 2 deletions docs/generate/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Most of the information you'll need to generate a Python client can be found in

<!-- LINKS -->
[general]: https://github.com/Azure/autorest/tree/master/docs/generate/readme.md
[multiapi]: ./multiapi.md
[directives]: ./directives.md
[multiapi]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/multiapi.md
[directives]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/directives.md
2 changes: 1 addition & 1 deletion docs/migrate/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ code for this, and you can see our [tracing docs][tracing_docs] for more informa
[mypy]: https://mypy.readthedocs.io/en/stable/introduction.html
[open_census]: https://opencensus.io/
[open_telemetry]: https://opentelemetry.io/
[tracing_docs]: ../client/tracing.md
[tracing_docs]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/tracing.md
20 changes: 10 additions & 10 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ These documents are Python-specific, see [our main docs][main_docs] for more gen
7. [Troubleshooting][troubleshooting]

<!-- LINKS -->
[main_docs]: https://github.com/Azure/autorest/tree/master/docs
[main_docs]: https://github.com/Azure/autorest/tree/master/docs/readme.md
[main_generate]: https://github.com/Azure/autorest/tree/master/docs/generate/readme.md
[python_generate]: ./generate/readme.md
[python_client]: ./client/readme.md
[main_client]: https://github.com/Azure/autorest/tree/master/docs/generate/client.md
[python_generate]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/generate/readme.md
[python_client]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/client/readme.md
[main_client]: https://github.com/Azure/autorest/tree/master/docs/client/readme.md
[main_migrate]: https://github.com/Azure/autorest/tree/master/docs/migrate/readme.md
[python_migrate]: ./migrate/readme.md
[python_dev]: ./developer/readme.md
[main_dev]: https://github.com/Azure/autorest/tree/master/docs/dev/readme.md
[sample]: ./samples/readme.md
[faq]: ./faq.md
[troubleshooting]: ./troubleshooting.md
[python_migrate]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/migrate/readme.md
[python_dev]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/developer/readme.md
[main_dev]: https://github.com/Azure/autorest/tree/master/docs/developer/readme.md
[sample]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/readme.md
[faq]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/faq.md
[troubleshooting]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/troubleshooting.md
16 changes: 8 additions & 8 deletions docs/samples/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Here are our samples for common generation scenarios
|Generating with [`AzureKeyCredential`][azure_key_credential] | [readme.md][azure_key_credential_readme] | [generated][azure_key_credential_generated]

<!-- LINKS -->
[basic_readme]: ./specification/basic/readme.md
[basic_generated]: ./specification/basic/generated
[basic_readme]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/basic/readme.md
[basic_generated]: https://github.com/Azure/autorest.python/tree/autorestv3/docs/samples/specification/basic/generated
[mgmt]: https://docs.microsoft.com/azure/azure-resource-manager/management/control-plane-and-data-plane#control-plane
[mgmt_readme]: ./specification/management/readme.md
[mgmt_generated]: ./specification/management/generated
[multiapi_readme]: ./specification/multiapi/readme.md
[multiapi_generated]: ./specification/multiapi/generated
[mgmt_readme]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/management/readme.md
[mgmt_generated]: https://github.com/Azure/autorest.python/tree/autorestv3/docs/samples/specification/management/generated
[multiapi_readme]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/multiapi/readme.md
[multiapi_generated]: https://github.com/Azure/autorest.python/tree/autorestv3/docs/samples/specification/multiapi/generated
[azure_key_credential]: https://docs.microsoft.com/python/api/azure-core/azure.core.credentials.azurekeycredential?view=azure-python
[azure_key_credential_readme]: ./specification/azure_key_credential/readme.md
[azure_key_credential_generated]: ./specification/azure_key_credential/generated
[azure_key_credential_readme]: https://github.com/Azure/autorest.python/blob/autorestv3/docs/samples/specification/azure_key_credential/readme.md
[azure_key_credential_generated]: https://github.com/Azure/autorest.python/tree/autorestv3/docs/samples/specification/azure_key_credential/generated
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def _basic_polling_initial(
return cls(pipeline_response, deserialized, {})

return deserialized
_basic_polling_initial.metadata = {'url': '/directives/polling'} # type: ignore
_basic_polling_initial.metadata = {'url': '/basic/polling'} # type: ignore

async def begin_basic_polling(
self,
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_long_running_output(pipeline_response):
)
else:
return AsyncCustomPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_basic_polling.metadata = {'url': '/directives/polling'} # type: ignore
begin_basic_polling.metadata = {'url': '/basic/polling'} # type: ignore

def basic_paging(
self,
Expand Down Expand Up @@ -187,4 +187,4 @@ async def get_next(next_link=None):
return AsyncCustomPager(
get_next, extract_data
)
basic_paging.metadata = {'url': '/directives/paging'} # type: ignore
basic_paging.metadata = {'url': '/basic/paging'} # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _basic_polling_initial(
return cls(pipeline_response, deserialized, {})

return deserialized
_basic_polling_initial.metadata = {'url': '/directives/polling'} # type: ignore
_basic_polling_initial.metadata = {'url': '/basic/polling'} # type: ignore

def begin_basic_polling(
self,
Expand Down Expand Up @@ -132,7 +132,7 @@ def get_long_running_output(pipeline_response):
)
else:
return CustomPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_basic_polling.metadata = {'url': '/directives/polling'} # type: ignore
begin_basic_polling.metadata = {'url': '/basic/polling'} # type: ignore

def basic_paging(
self,
Expand Down Expand Up @@ -193,4 +193,4 @@ def get_next(next_link=None):
return CustomPager(
get_next, extract_data
)
basic_paging.metadata = {'url': '/directives/paging'} # type: ignore
basic_paging.metadata = {'url': '/basic/paging'} # type: ignore
Loading