Skip to content

Commit

Permalink
Renamed SpecificationExtensions to SpecificationExtension
Browse files Browse the repository at this point in the history
  • Loading branch information
KostyaTretyak committed Feb 13, 2021
1 parent 23c8069 commit ba01484
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions versions/3.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ npm i @ts-stack/open-api-spec

[1]: https://github.com/OAI/OpenAPI-Specification

## SpecificationExtensions Usage
## SpecificationExtension Usage

You can extends any of model in this way:

```ts
import { OasObject, SpecificationExtensions } from '@ts-stack/open-api-spec';
import { OasObject, SpecificationExtension } from '@ts-stack/open-api-spec';

type ExtendedOasObject = OasObject & SpecificationExtensions<'x-one' | 'x-two'>;
type ExtendedOasObject = OasObject & SpecificationExtension<'x-one' | 'x-two'>;

const extendedOasObject: ExtendedOasObject = {
info: {title: '', version: ''},
Expand All @@ -51,14 +51,14 @@ const extendedOasObject: ExtendedOasObject = {
Same but with an interface to extends properties:

```ts
import { OasObject, SpecificationExtensions } from '@ts-stack/open-api-spec';
import { OasObject, SpecificationExtension } from '@ts-stack/open-api-spec';

interface ExtendedProperties {
'x-one': any,
'x-two': any
}

type ExtendedOasObject = OasObject & SpecificationExtensions<keyof ExtendedProperties>;
type ExtendedOasObject = OasObject & SpecificationExtension<keyof ExtendedProperties>;

const extendedOasObject: ExtendedOasObject = {
info: {title: '', version: ''},
Expand Down
2 changes: 1 addition & 1 deletion versions/3.1/src/specification-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* The extensions may or may not be supported by the available tooling, but those may be extended
* as well to add requested support (if tools are internal or open-sourced).
*/
export type SpecificationExtensions<T extends SpecExtFieldPattern = any> = {
export type SpecificationExtension<T extends SpecExtFieldPattern> = {
/**
* Allows extensions to the OpenAPI Schema. The field name MUST begin with `x-`, for example,
* `x-internal-id`. The value can be null, a primitive, an array or an object. Can have any valid
Expand Down

0 comments on commit ba01484

Please sign in to comment.