Skip to content

Commit

Permalink
Adding a bootstrap Swagger example file
Browse files Browse the repository at this point in the history
- Fixing broken documentation links
  • Loading branch information
tbombach committed Oct 11, 2016
1 parent 71c74e3 commit 3a6c013
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ Swagger files are simply JSON files that follow the [OpenAPI Specification](http
### Documentation
The [/documentation](../documentation/) folder contains many resources for writing Swagger files.

The [Swagger Good Patterns](./documentation/swagger-good-patterns.md) page is intended as a guide for different scenarios. If you know the service behavior that you're trying to model (e.g. PUT/PATCH/GET responses and request schemas, or modeling long running operations), that document is structured to make it easy to find our recommendations.
The [Swagger Good Patterns](../documentation/swagger-good-patterns.md) page is intended as a guide for different scenarios. If you know the service behavior that you're trying to model (e.g. PUT/PATCH/GET responses and request schemas, or modeling long running operations), that document is structured to make it easy to find our recommendations.

The [Reference Documentation](./documentation/creating-swagger.md) page contains lots of information about each part of a Swagger file and how to structure it correctly for code generation. If you're looking for an explanation of what a part of Swagger relates to your service or how it's used to generate code, that document is the right place to go.
The [Reference Documentation](../documentation/creating-swagger.md) page contains lots of information about each part of a Swagger file and how to structure it correctly for code generation. If you're looking for an explanation of what a part of Swagger relates to your service or how it's used to generate code, that document is the right place to go.

The [Linter](./documentation/linter.md) page has instructions for downloading our extension for VS Code and links to explanations for each validation error or warning.
The [Linter](../documentation/linter.md) page has instructions for downloading our extension for VS Code and links to explanations for each validation error or warning.

### Filenames and folder structure
- Swagger spec for every api-version should be in a separate folder named with the api-version.
Expand Down
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ This checklist is used to make sure that common issues in a pull request are add

### PR information
- [ ] The title of the PR is clear and informative.
- [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](../documentation/cleaning-up-commits.md).
- [ ] There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For information on cleaning up the commits in your pull request, [see this page](https://github.com/Azure/azure-powershell/blob/dev/documentation/cleaning-up-commits.md).
- [ ] Except for special cases involving multiple contributors, the PR is started from a fork of the main repository, not a branch.
- [ ] If applicable, the PR references the bug/issue that it fixes.
- [ ] Swagger files are correctly named (e.g. the `api-version` in the path should match the `api-version` in the spec).

### Quality of Swagger
- [ ] I have read the [contribution guidelines](./CONTRIBUTING.md).
- [ ] I have read the [contribution guidelines](https://github.com/Azure/azure-rest-api-specs/blob/master/.github/CONTRIBUTING.md).
- [ ] My spec meets the review criteria:
- [ ] The spec conforms to the [Swagger 2.0 specification](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md).
- [ ] Validation errors from the [Linter extension for VS Code](../documentation/linter.md) have all been fixed for this spec. (**Note:** for large, previously checked in specs, there will likely be many errors shown. Please contact our team so we can set a timeframe for fixing these errors if your PR is not going to address them).
- [ ] The spec follows the patterns described in the [Swagger good patterns](../documentation/swagger-good-patterns.md) document unless the service API makes this impossible.
- [ ] Validation errors from the [Linter extension for VS Code](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/linter.md) have all been fixed for this spec. (**Note:** for large, previously checked in specs, there will likely be many errors shown. Please contact our team so we can set a timeframe for fixing these errors if your PR is not going to address them).
- [ ] The spec follows the patterns described in the [Swagger good patterns](https://github.com/Azure/azure-rest-api-specs/blob/master/documentation/swagger-good-patterns.md) document unless the service API makes this impossible.
110 changes: 110 additions & 0 deletions documentation/swagger-bootstrap.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"swagger": "2.0",
"info": {
"title": "MyService",
"description": "Rest API for MyService",
"version": "Replace with MyService api version (e.g. 2016-04-02)"
},
"host": "management.azure.com",
"schemes": [
"https"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"security": [
{
"azure_auth": [
"user_impersonation"
]
}
],
"securityDefinitions": {
"azure_auth": {
"type": "oauth2",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize",
"flow": "implicit",
"description": "Azure Active Directory OAuth2 Flow",
"scopes": {
"user_impersonation": "impersonate your user account"
}
}
},
"paths": {
/*
* Fill out this section with your path definitions, then remove this comment

"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.MyService/pet/{name}": {
"get": {
"operationId": "Pets_Get",
"description": "Retrieve an existing Pet",
"parameters": [
{ "$ref": "#/parameters/subscriptionId" },
{ "$ref": "#/parameters/resourceGroupNameParameter" },
{
"name": "name",
"in": "path",
"description": "The name of the pet.",
"required": true,
"type": "string"
}
],
"responses": {
"201": {
"description": "The Pet for the specified name"
"schema": {
"$ref": "#/definitions/Pet"
}
}
}
}
}
*/
},
"definitions": {
/*
* Fill out this section with your model definitions, then remove this comment

"Pet": {
"description": "A pet.",
"type": "object",
"properties": {
"name": {
"description": "The name of the pet.",
"type": "string",
}
}
}
*/
},
"parameters": {
"subscriptionIdParameter": {
"name": "subscriptionId",
"in": "path",
"description": "Azure Subscription ID.",
"required": true,
"type": "string"
},
"apiVersionParameter": {
"name": "api-version",
"in": "query",
"required": true,
"type": "string",
"description": "Version of the API to be used with the client request. Current version is 2016-04-02"
},
"resourceGroupNameParameter": {
"name": "resourceGroupName",
"in": "path",
"required": true,
"type": "string",
"pattern": "^[-\\w\\._\\(\\)]+$",
"minLength": 1,
"maxLength": 90,
"x-ms-parameter-location": "method",
"description": "Name of an Azure Resource group."
}
}
}

0 comments on commit 3a6c013

Please sign in to comment.