-
Notifications
You must be signed in to change notification settings - Fork 22
feat(ls): add documentation rules for OpenAPI 3.1.0 #1946
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
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
185ed64
feat(apidom-ls): initial oas3.1 path item object documentation
tim-lai 9727393
feat(apidom-ls): render paths, path-item
tim-lai a7d4c82
feat(apidom-ls): render servers, server, serverVariables
tim-lai 2a8d5bc
refactor(apidom-ls): wip update oas31 paths documentation
tim-lai d711b98
feat(apidom-ls): oas31 paths documentation
tim-lai 7b9603a
feat(apidom-ls): oas31 path-item documentation
tim-lai 9afff1c
refactor(apidom-ls): oas31 docs move to reusable docsPathItemObject
tim-lai 63dddd7
feat(apidom-ls): oas31 operation object documentation in path-item
tim-lai 38323bf
feat(apidom-ls): oas31 servers documentation for path-item
tim-lai 6668be5
feat(apidom-ls): oas31 parameters object documentation in path-item
tim-lai 6b94a2f
refactor(apidom-ls): oas31 remove style examples from path-item docs
tim-lai 5e2b875
feat(apidom-ls): oas31 move some docs from pathItem to parent element
tim-lai 03eeb11
feat(apidom-ls): oas31 docs add targets for parameter object
tim-lai 82809b4
feat(apidom-ls): oas31 docs add targets for operation object
tim-lai e9db51c
fix(apidom-ls): wip oas31 docs for serverVariables object
tim-lai 783084b
fix(apidom-ls): oas31 minor changes to pathItem target docs
tim-lai 22defb1
fix(apidom-ls): fix oas31 pathItem description docs
tim-lai 5fbf715
fix(apidom-ls): remove extraneous oas31 symbols
tim-lai c2a3ead
feat(apidom-ls): add serverVariable to openapi config
tim-lai 79d4376
fix(apidom-ls): oas31 meta docs for server-variables
tim-lai 0d46a49
refactor(apidom-ls): rename oas31 server-variables
tim-lai 3731dc0
refactor(apidom-ls): minor fixes to oas31 operation docs
tim-lai 0304b0a
feat(apidom-ls): oas31 docs licenseobject
tim-lai c5a38e8
feat(apidom-ls): oas31 docs for tags
tim-lai 129507a
fix(apidom-ls): cumulative oas31 docs feedback changes
tim-lai ec86af3
feat(apidom-ls): oas31 docs for externalDocs
tim-lai b17dde4
feat(apidom-ls): oas31 docs more operation object fields
tim-lai 5187be7
feat(apidom-ls): oas31 docs for responses object
tim-lai ab222ec
refactor(apidom-ls): rename externalDocs to externalDocumentation
tim-lai 8192648
refactor(apidom-ls): remove unnecessary server-variables directory
tim-lai af4e5b1
feat(apidom-ls): oas31 docs add targetSpecs to various objects
tim-lai 696f627
refactor(apidom-ls): oas31 docs remove placeholder imports
tim-lai bbd20e0
chore(apidom-ls): oas31 docs remove linting comments
tim-lai 2810010
refactor(apidom-ls): oas31 docs parameter content field
tim-lai 5ed1bb0
refactor(apidom-ls): oas31 docs directly set value as string
tim-lai 82ec71c
refactor(apidom-ls): oas31 docs remove unneed tags.externalDocs
tim-lai e70fdb5
chore(apidom-ls): oas31 docs remove comments about oas30
tim-lai 5bdef78
feat(apidom-ls): oas31 docs tag object
tim-lai ae23041
feat(apidom-ls): oas31 docs openapi3_1 with tags and servers
tim-lai 1d9bb85
chore(apidom-ls): oas31 docs dev comments for disabled targets
tim-lai dc3eb1d
feat(apidom-ls): oas31 docs complete openapi3_1 fields
tim-lai 5c1161c
Merge branch 'main' into feat/oas31-documentation-1
tim-lai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
packages/apidom-ls/src/config/openapi/external-documentation/documentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const documentation = [ | ||
{ | ||
target: 'url', | ||
docs: '**REQUIRED**. The URL for the target documentation. This MUST be in the form of a URL.', | ||
}, | ||
{ | ||
target: 'description', | ||
docs: 'A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.', | ||
}, | ||
{ | ||
docs: '#### [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#external-documentation-object)\n\nAllows referencing an external resource for extended documentation.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\ndescription | `string` | A description of the target documentation. [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.\nurl | `string` | **REQUIRED**. The URL for the target documentation. This MUST be in the form of a URL.\n\n\\\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### External Documentation Object Example\n\n\n\\\nJSON\n```json\n{\n "description": "Find more info here",\n "url": "https://example.com"\n}\n```\n\n\n\\\nYAML\n```yaml\ndescription: Find more info here\nurl: https://example.com\n```', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
]; | ||
|
||
export default documentation; |
8 changes: 8 additions & 0 deletions
8
packages/apidom-ls/src/config/openapi/external-documentation/meta.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import documentation from './documentation'; | ||
import { FormatMeta } from '../../../apidom-language-types'; | ||
|
||
const meta: FormatMeta = { | ||
documentation, | ||
}; | ||
|
||
export default meta; |
22 changes: 22 additions & 0 deletions
22
packages/apidom-ls/src/config/openapi/license/documentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const documentation = [ | ||
{ | ||
target: 'name', | ||
docs: '**REQUIRED**. The license name used for the API.', | ||
}, | ||
{ | ||
target: 'identifier', | ||
docs: 'An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field.', | ||
tim-lai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'url', | ||
docs: 'A URL to the license used for the API. This MUST be in the form of a URL. The `url` field is mutually exclusive of the `identifier` field.', | ||
tim-lai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
docs: '#### [License Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#licenseObject)\n\nLicense information for the exposed API.\n\n##### Fixed Fields\n\nField Name | Type | Description\n---|:---:|---\nname | `string` | **REQUIRED**. The license name used for the API.\nidentifier | `string` | An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API. The `identifier` field is mutually exclusive of the `url` field.\nurl | `string` | A URL to the license used for the API. This MUST be in the form of a URL. The `url` field is mutually exclusive of the `identifier` field.\n\nThis object MAY be extended with [Specification Extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#specificationExtensions).\n\n##### License Object Example\n\n\n\\\nJSON\n```json\n{\n "name": "Apache 2.0",\n "identifier": "Apache-2.0"\n}\n```\n\n\n\\\nYAML\n```yaml\nname: Apache 2.0\nidentifier: Apache-2.0\n```', | ||
tim-lai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
]; | ||
|
||
export default documentation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import documentation from './documentation'; | ||
import { FormatMeta } from '../../../apidom-language-types'; | ||
|
||
const meta: FormatMeta = { | ||
documentation, | ||
}; | ||
|
||
export default meta; |
58 changes: 58 additions & 0 deletions
58
packages/apidom-ls/src/config/openapi/openapi3_1/documentation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
const documentation = [ | ||
tim-lai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
target: 'openapi', | ||
docs: '`string`\n\n**REQUIRED**. This string MUST be the [version number](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#versions) of the OpenAPI Specification that the OpenAPI document uses. The `openapi` field SHOULD be used by tooling to interpret the OpenAPI document. This is *not* related to the API [`info.version`](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoVersion) string.', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'jsonSchemaDialect', | ||
docs: '`string`\n\nThe default value for the `$schema` keyword within [Schema Objects](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schemaObject) contained within this OAS document. This MUST be in the form of a URI.', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'webhooks', | ||
docs: 'Map[`string`, [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathItemObject) | [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#referenceObject)]\n\n The incoming webhooks that MAY be received as part of this API and that the API consumer MAY choose to implement. Closely related to the `callbacks` feature, this section describes requests initiated other than by an API call, for example by an out of band registration. The key name is a unique string to refer to each webhook, while the (optionally referenced) Path Item Object describes a request that may be initiated by the API provider and the expected responses. An [example](https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.1/webhook-example.yaml) is available.', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'security', | ||
docs: '#### [[Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#securityRequirementObject)]\n\nA declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. Individual operations can override this definition. To make security optional, an empty security requirement ({}) can be included in the array.', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'servers', | ||
tim-lai marked this conversation as resolved.
Show resolved
Hide resolved
|
||
docs: '#### [[Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject)]\n\nAn array of Server Objects, which provide connectivity information to a target server. If the `servers` property is not provided, or is an empty array, the default value would be a [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverObject) with a [url](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#serverUrl) value of `/`.', | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
{ | ||
target: 'tags', | ||
docs: "#### [[Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#tagObject)]\n\nA list of tags used by the document with additional metadata. The order of the tags can be used to reflect on their order by the parsing tools. Not all tags that are used by the [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#operationObject) must be declared. The tags that are not declared MAY be organized randomly or based on the tools' logic. Each tag name in the list MUST be unique.", | ||
targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
}, | ||
/** | ||
* The following Fixed Fields are provided as reference, but are more | ||
* comprehensively described by their respective meta documentation | ||
*/ | ||
// { | ||
// target: 'info', | ||
// docs: '#### [Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#infoObject)\n\n**REQUIRED**. Provides metadata about the API. The metadata MAY be used by tooling as required.', | ||
// targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
// }, | ||
// { | ||
// target: 'paths', | ||
// docs: '#### [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#pathsObject)\n\nThe available paths and operations for the API.', | ||
// targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
// }, | ||
// { | ||
// target: 'components', | ||
// docs: '#### [Components Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#componentsObject)\n\nAn element to hold various schemas for the document.', | ||
// targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
// }, | ||
// { | ||
// target: 'externalDocs', | ||
// docs: '#### [External Dcoumentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#externalDocumentationObject)\n\nAdditional external documentation.', | ||
// targetSpecs: [{ namespace: 'openapi', version: '3.1.0' }], | ||
// }, | ||
]; | ||
|
||
export default documentation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import documentation from './documentation'; | ||
import { FormatMeta } from '../../../apidom-language-types'; | ||
|
||
const meta: FormatMeta = { | ||
documentation, | ||
}; | ||
|
||
export default meta; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.