Skip to content

Commit

Permalink
master -> feat/routing_platform_independence
Browse files Browse the repository at this point in the history
  • Loading branch information
flamewow committed May 23, 2022
2 parents d00cb8b + 548e1bf commit b11e8b4
Show file tree
Hide file tree
Showing 14 changed files with 4,714 additions and 3,005 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Stack Overflow is a much better place to ask questions since:

To save your and our time, we will systematically close all issues that are requests for general support and redirect people to Stack Overflow.

If you would like to chat about the question in real-time, you can reach out via [our gitter channel][gitter].
If you would like to chat about the question in real-time, you can reach out via [our discord channel][discord].

## <a name="issue"></a> Found a Bug?
If you find a bug in the source code, you can help us by
Expand Down Expand Up @@ -243,7 +243,7 @@ changes to be accepted, the CLA must be signed. It's a quick process, we promise
[corporate-cla]: http://code.google.com/legal/corporate-cla-v1.0.html
[dev-doc]: https://github.com/nestjs/nest/blob/master/docs/DEVELOPER.md
[github]: https://github.com/nestjs/nest
[gitter]: https://gitter.im/nestjs/nest
[discord]: https://discord.gg/nestjs
[individual-cla]: http://code.google.com/legal/individual-cla-v1.0.html
[js-style-guide]: https://google.github.io/styleguide/jsguide.html
[jsfiddle]: http://jsfiddle.net
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Kamil Mysliwiec
Copyright (c) 2020-2022 Kamil Mysliwiec

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>

<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
</p>
Expand All @@ -25,7 +25,7 @@
## Installation

```bash
$ npm i --save @nestjs/swagger
$ npm i --save @nestjs/swagger
```

## Quick Start
Expand Down
9 changes: 4 additions & 5 deletions e2e/validate-schema.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { INestApplication } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { writeFileSync } from 'fs';
import type { OpenAPIV3 } from 'openapi-types';
import { join } from 'path';
import * as SwaggerParser from 'swagger-parser';
import {
Expand Down Expand Up @@ -73,7 +72,9 @@ describe('Validate OpenAPI schema', () => {

it('should fix colons in url', async () => {
const document = SwaggerModule.createDocument(app, options);
expect(document.paths['/api/v1/express:colon:another/{prop}']).toBeDefined();
expect(
document.paths['/api/v1/express:colon:another/{prop}']
).toBeDefined();
});

it('should merge custom components passed via config', async () => {
Expand Down Expand Up @@ -107,9 +108,7 @@ describe('Validate OpenAPI schema', () => {
}
});

let api = (await SwaggerParser.validate(
document as any
)) as OpenAPIV3.Document;
let api = await SwaggerParser.validate(document as any);
console.log('API name: %s, Version: %s', api.info.title, api.info.version);
expect(api.components.schemas).toHaveProperty('Person');
expect(api.components.schemas).toHaveProperty('Cat');
Expand Down
10 changes: 6 additions & 4 deletions lib/decorators/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ export function createMixedDecorator<T = any>(
if (descriptor) {
let metadatas: any;
if (Array.isArray(metadata)) {
const previousMetadata = Reflect.getMetadata(metakey, descriptor.value) || [];
const previousMetadata =
Reflect.getMetadata(metakey, descriptor.value) || [];
metadatas = [...previousMetadata, ...metadata];
} else {
const previousMetadata = Reflect.getMetadata(metakey, descriptor.value) || {};
metadatas = {...previousMetadata, ...metadata};
const previousMetadata =
Reflect.getMetadata(metakey, descriptor.value) || {};
metadatas = { ...previousMetadata, ...metadata };
}
Reflect.defineMetadata(metakey, metadatas, descriptor.value);
return descriptor;
Expand Down Expand Up @@ -140,5 +142,5 @@ export function getTypeIsArrayTuple(
}
const isInputArray = isArray(input);
const type = isInputArray ? input[0] : input;
return [type, isInputArray];
return [type as Function, isInputArray];
}

0 comments on commit b11e8b4

Please sign in to comment.