Skip to content

Commit

Permalink
Added contact-object, license-object and xml-object to exports
Browse files Browse the repository at this point in the history
  • Loading branch information
KostyaTretyak committed Mar 26, 2021
1 parent 9a9a61f commit f279802
Show file tree
Hide file tree
Showing 8 changed files with 498 additions and 8 deletions.
3 changes: 3 additions & 0 deletions versions/3.1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,8 @@ export * from './src/extended/security-scheme-object';
export * from './src/extended/server-object';
export * from './src/extended/server-variable-object';
export * from './src/extended/tag-object';
export * from './src/extended/contact-object';
export * from './src/extended/license-object';
export * from './src/extended/xml-object';
export { XSchemaObject } from './src/extended/schema-object';
export { XPathsObject } from './src/extended/paths-object';
42 changes: 42 additions & 0 deletions versions/3.1/src/extended/contact-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { SpecExtFieldPattern, SpecificationExtension } from '../origin/specification-extension';

/**
* Contact information for the exposed API.
*
* This object MAY be extended with [Specification Extensions][1].
*
* [1]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#specificationExtensions
*
* ### Example with JSON
*
```json
{
"name": "API Support",
"url": "https://www.example.com/support",
"email": "[email protected]"
}
```
*
* ### Example with YAML
*
```yaml
name: API Support
url: https://www.example.com/support
email: [email protected]
```
*/
export type XContactObject<T extends SpecExtFieldPattern = any> = SpecificationExtension<T> & {
/**
* The identifying name of the contact person/organization.
*/
name?: string;
/**
* The URL pointing to the contact information. This MUST be in the form of a URL.
*/
url?: string;
/**
* The email address of the contact person/organization.
* This MUST be in the form of an email address.
*/
email?: string;
}
8 changes: 4 additions & 4 deletions versions/3.1/src/extended/info-object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContactObject } from '../origin/contact-object';
import { LicenseObject } from '../origin/license-object';
import { XContactObject } from './contact-object';
import { XLicenseObject } from './license-object';
import { SpecExtFieldPattern, SpecificationExtension } from '../origin/specification-extension';

/**
Expand Down Expand Up @@ -72,11 +72,11 @@ export type XInfoObject<T extends SpecExtFieldPattern = any> = SpecificationExte
/**
* The contact information for the exposed API.
*/
contact?: ContactObject;
contact?: XContactObject;
/**
* The license information for the exposed API.
*/
license?: LicenseObject;
license?: XLicenseObject;
/**
* The version of the OpenAPI document (which is distinct from the
* [OpenAPI Specification version][1] or the API implementation version).
Expand Down
43 changes: 43 additions & 0 deletions versions/3.1/src/extended/license-object.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { SpecExtFieldPattern, SpecificationExtension } from '../origin/specification-extension';

/**
* License information for the exposed API.
*
* This object MAY be extended with [Specification Extensions][1].
*
* [1]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#specificationExtensions
*
* ### Example with JSON
*
```json
{
"name": "Apache 2.0",
"identifier": "Apache-2.0"
}
```
*
* ### Example with YAML
*
```yaml
name: Apache 2.0
identifier: Apache-2.0
```
*/
export type XLicenseObject<T extends SpecExtFieldPattern = any> = SpecificationExtension<T> & {
/**
* The license name used for the API.
*/
name: string;
/**
* An [SPDX][1] license expression for the API. The `identifier` field is mutually exclusive
* of the `url` field.
*
* [1]: https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60
*/
identifier?: 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.
*/
url?: string;
};
3 changes: 2 additions & 1 deletion versions/3.1/src/extended/paths-object.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SpecExtFieldPattern, SpecificationExtension } from '../origin/specification-extension';
import { XPathItemObject } from './path-item-object';

/**
Expand Down Expand Up @@ -78,7 +79,7 @@ import { XPathItemObject } from './path-item-object';
* [2]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#securityFiltering
* [3]: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#specificationExtensions
*/
export type XPathsObject<T extends PathFieldPattern = any> = {
export type XPathsObject<T extends PathFieldPattern = any, E extends SpecExtFieldPattern = any> = SpecificationExtension<E> & {
/**
* A relative path to an individual endpoint. The field name MUST begin with a forward
* slash (`/`). The path is **appended** (no relative URL resolution) to the expanded URL
Expand Down
4 changes: 2 additions & 2 deletions versions/3.1/src/extended/schema-object.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { XDiscriminatorObject } from './discriminator-object';
import { XExternalDocumentationObject } from './external-documentation-object';
import { XmlObject } from '../origin/xml-object';
import { XXmlObject } from './xml-object';
import { SpecExtFieldPattern, SpecificationExtension } from '../origin/specification-extension';

export type SchemaObjectType = 'null' | 'boolean' | 'object' | 'array' | 'number' | 'string' | 'integer';
Expand Down Expand Up @@ -1232,7 +1232,7 @@ export type XSchemaObject<T extends SpecExtFieldPattern = any> = SpecificationEx
* This MAY be used only on properties schemas. It has no effect on root schemas. Adds additional
* metadata to describe the XML representation of this property.
*/
xml?: XmlObject;
xml?: XXmlObject;
/**
* Additional external documentation for this schema.
*/
Expand Down
Loading

0 comments on commit f279802

Please sign in to comment.