Skip to content

Commit

Permalink
refactor: rename files
Browse files Browse the repository at this point in the history
  • Loading branch information
jannyHou committed Jan 3, 2018
1 parent b541986 commit 278850c
Show file tree
Hide file tree
Showing 33 changed files with 93 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/authentication/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@loopback/context": "^4.0.0-alpha.24",
"@loopback/core": "^4.0.0-alpha.26",
"@loopback/openapi-specgen": "1.0.0-alpha1",
"@loopback/openapi-v2": "1.0.0-alpha1",
"@loopback/rest": "^4.0.0-alpha.15",
"passport": "^0.4.0",
"passport-strategy": "^1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/test/acceptance/basic-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RestServer,
RestComponent,
} from '@loopback/rest';
import {api, get} from '@loopback/openapi-specgen';
import {api, get} from '@loopback/openapi-v2';
import {Client, createClientForHandler} from '@loopback/testlab';
import {anOpenApiSpec} from '@loopback/openapi-spec-builder';
import {inject, Provider, ValueOrPromise} from '@loopback/context';
Expand Down
Empty file removed packages/openapi-specgen/README.md
Empty file.
1 change: 0 additions & 1 deletion packages/openapi-specgen/src/index.ts

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
77 changes: 77 additions & 0 deletions packages/openapi-v2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
@loopback/openapi-v2

This package contains:

- Decorators that describe LoopBack artifacts as metadata.
- Uilities that tranfer LoopBack remoting metadata to swagger specifications.

## Installation

```
$ npm install --save @loopback/openapi-v2
```

## Basic use

Currently this package only has spec generator for controllers.
It generates swagger `paths` and `basePath` specs for a given decorated controller class.

Here is an example of calling function `getControllerSpec` to generate the swagger spec:

```js
import {api, getControllerSpec} from '@loopback/openapi-v2';

@api(somePathSpec)
class MyController {
greet() {
return 'Hello world!';
}
}

const myControllerSpec = getControllerSpec(MyController);
```

then the `myControllerSpec` will be:
```js
{
swagger: '2.0',
basePath: '/',
info: { title: 'LoopBack Application', version: '1.0.0' },
paths: {
'/greet': {
get: {
responses: {
'200': {
description: 'The string result.',
schema: { type: 'string' }
}
},
'x-operation-name': 'greet'
}
}
}
}
```

For details of how to apply controller decorators, please check http://loopback.io/doc/en/lb4/Decorators.html#route-decorators

## Related resources

See https://www.openapis.org/ and [version 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
of OpenAPI Specification.

## Contributions

IBM/StrongLoop is an active supporter of open source and welcomes contributions to our projects as well as those of the Node.js community in general. For more information on how to contribute please refer to the [Contribution Guide](https://loopback.io/doc/en/contrib/index.html).

# Tests

run `npm test` from the root folder.

# Contributors

See [all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

# License

MIT
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@loopback/openapi-specgen",
"name": "@loopback/openapi-v2",
"version": "1.0.0-alpha1",
"description": "Spec gen",
"description": "Processes openapi v2 related metadata",
"engines": {
"node": ">=6"
},
Expand All @@ -16,11 +16,11 @@
"build:dist": "lb-tsc es2017",
"build:dist6": "lb-tsc es2015",
"build:apidocs": "lb-apidocs",
"clean": "rm -rf loopback-openapi-specgen*.tgz dist* package",
"clean": "rm -rf loopback-openapi-v2*.tgz dist* package",
"prepare": "npm run build && npm run build:apidocs",
"pretest": "npm run build:current",
"unit": "lb-dist mocha --opts ../../test/mocha.opts 'DIST/test/unit/**/*.js'",
"verify": "npm pack && tar xf loopback-openapi-specgen*.tgz && tree package && npm run clean"
"verify": "npm pack && tar xf loopback-openapi-v2*.tgz && tree package && npm run clean"
},
"author": "IBM",
"license": "MIT",
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions packages/openapi-v2/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './controller-spec';
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@loopback/context": "^4.0.0-alpha.23",
"@loopback/core": "^4.0.0-alpha.25",
"@loopback/openapi-spec": "^4.0.0-alpha.17",
"@loopback/openapi-specgen": "^1.0.0-alpha.1",
"@loopback/openapi-v2": "^1.0.0-alpha.1",
"@types/http-errors": "^1.6.1",
"body": "^5.1.0",
"debug": "^3.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/src/http-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {Context} from '@loopback/context';
import {PathsObject} from '@loopback/openapi-spec';
import {ServerRequest, ServerResponse} from 'http';
import {ControllerSpec} from '@loopback/openapi-specgen';
import {ControllerSpec} from '@loopback/openapi-v2';

import {SequenceHandler} from './sequence';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/src/rest-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import {ServerRequest, ServerResponse, createServer} from 'http';
import * as Http from 'http';
import {Application, CoreBindings, Server} from '@loopback/core';
import {getControllerSpec} from '@loopback/openapi-specgen';
import {getControllerSpec} from '@loopback/openapi-v2';
import {HttpHandler} from './http-handler';
import {DefaultSequence, SequenceHandler, SequenceFunction} from './sequence';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/src/router/routing-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
OperationRetval,
} from '../internal-types';

import {ControllerSpec} from '@loopback/openapi-specgen';
import {ControllerSpec} from '@loopback/openapi-v2';

import * as assert from 'assert';
import * as url from 'url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
RestComponent,
} from '../../..';

import {api, get, param} from '@loopback/openapi-specgen';
import {api, get, param} from '@loopback/openapi-v2';

import {Application} from '@loopback/core';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
RestServer,
RestComponent,
} from '../../..';
import {api} from '@loopback/openapi-specgen';
import {api} from '@loopback/openapi-v2';
import {Application} from '@loopback/core';
import {expect, Client, createClientForHandler} from '@loopback/testlab';
import {anOpenApiSpec} from '@loopback/openapi-spec-builder';
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/test/integration/http-handler.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
parseOperationArgs,
RestBindings,
} from '../..';
import {ControllerSpec, get} from '@loopback/openapi-specgen';
import {ControllerSpec, get} from '@loopback/openapi-v2';
import {Context} from '@loopback/context';
import {Client, createClientForHandler} from '@loopback/testlab';
import * as HttpErrors from 'http-errors';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import {expect, validateApiSpec} from '@loopback/testlab';
import {Application} from '@loopback/core';
import {RestServer, Route, RestComponent} from '../../..';
import {get} from '@loopback/openapi-specgen';
import {get} from '@loopback/openapi-v2';
import {anOpenApiSpec} from '@loopback/openapi-spec-builder';

describe('RestServer.getApiSpec()', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/rest/test/unit/router/routing-table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RoutingTable,
ControllerRoute,
} from '../../..';
import {getControllerSpec, param, get} from '@loopback/openapi-specgen';
import {getControllerSpec, param, get} from '@loopback/openapi-v2';
import {expect, ShotRequestOptions, ShotRequest} from '@loopback/testlab';
import {anOpenApiSpec} from '@loopback/openapi-spec-builder';

Expand Down

0 comments on commit 278850c

Please sign in to comment.