How to use the @loopback/openapi-v3.get function in @loopback/openapi-v3

To help you get started, we’ve selected a few @loopback/openapi-v3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strongloop / loopback-next / packages / rest / src / __tests__ / unit / router / routing-table.unit.ts View on Github external
it('finds "GET /orders, /orders/{id}, /orders/{orderId}/shipments" endpoints', () => {
    class TestController {
      @get('/orders/{id}')
      async getOrderById(@param.path.number('id') id: number): Promise {
        return {id};
      }
      // A path that overlaps with `/orders/{id}`. Please note a different var
      // name is used - `{orderId}`
      @get('/orders/{orderId}/shipments')
      async getShipmentsForOrder(
        @param.path.number('orderId') id: number,
      ): Promise {
        return [];
      }
      // With trailing `/`
      @get('/orders/')
      async findOrders(): Promise {
        return [];
      }
github strongloop / loopback-next / labs / authentication-passport / src / __tests__ / acceptance / authentication-with-passport-strategy-adapter.acceptance.ts View on Github external
it('allows anonymous requests to methods with no decorator', async () => {
    class InfoController {
      @get('/status')
      status() {
        return {running: true};
      }
    }

    app.controller(InfoController);
    await whenIMakeRequestTo(server)
      .get('/status')
      .expect(200, {running: true});
  });
github strongloop / loopback-next / packages / authentication / src / __tests__ / acceptance / basic-auth.acceptance.ts View on Github external
it('allows anonymous requests to methods with no decorator', async () => {
    class InfoController {
      @get('/status')
      status() {
        return {running: true};
      }
    }

    app.controller(InfoController);
    await whenIMakeRequestTo(server)
      .get('/status')
      .expect(200, {running: true});
  });
github strongloop / loopback-next / extensions / authentication-passport / src / __tests__ / acceptance / authentication-with-passport-strategy-adapter.acceptance.ts View on Github external
it(`allows anonymous requests to methods with no 'authenticate' decorator`, async () => {
    class InfoController {
      @get('/status')
      status() {
        return {running: true};
      }
    }

    app.controller(InfoController); //overriding 'beforeEach(givenControllerInApp);' above
    await remainingSetup(ScenarioEnum.WithoutProviders);
    await whenIMakeRequestTo(server)
      .get('/status')
      .expect(200, {running: true});
  });
github strongloop / loopback-next / packages / rest / src / __tests__ / integration / express.integration.ts View on Github external
beforeEach(function setupHelloController() {
      class HelloController {
        @get('/hello')
        public async greet(): Promise {
          return 'Hello world!';
        }
      }

      givenControllerClass(HelloController);
    });
github strongloop / loopback-next / examples / log-extension / src / __tests__ / acceptance / log.extension.acceptance.ts View on Github external
return 'error called';
      }

      @get('/off')
      @log(LOG_LEVEL.OFF)
      off() {
        return 'off called';
      }

      @get('/')
      @log()
      hello(@param.query.string('name') name: string) {
        return `hello ${name}`;
      }

      @get('/nolog')
      nolog() {
        return 'nolog called';
      }
    }

    app.controller(MyController);
  }
github strongloop / loopback-next / examples / log-extension / src / __tests__ / acceptance / log.extension.acceptance.ts View on Github external
return 'info called';
      }

      @get('/error')
      @log(LOG_LEVEL.ERROR)
      error() {
        return 'error called';
      }

      @get('/off')
      @log(LOG_LEVEL.OFF)
      off() {
        return 'off called';
      }

      @get('/')
      @log()
      hello(@param.query.string('name') name: string) {
        return `hello ${name}`;
      }

      @get('/nolog')
      nolog() {
        return 'nolog called';
      }
    }

    app.controller(MyController);
  }
github strongloop / loopback-next / examples / log-extension / src / __tests__ / acceptance / log.extension.acceptance.ts View on Github external
return 'debug called';
      }

      @get('/warn')
      @log(LOG_LEVEL.WARN)
      warn() {
        return 'warn called';
      }

      @get('/info')
      @log(LOG_LEVEL.INFO)
      info() {
        return 'info called';
      }

      @get('/error')
      @log(LOG_LEVEL.ERROR)
      error() {
        return 'error called';
      }

      @get('/off')
      @log(LOG_LEVEL.OFF)
      off() {
        return 'off called';
      }

      @get('/')
      @log()
      hello(@param.query.string('name') name: string) {
        return `hello ${name}`;
      }
github strongloop / loopback-next / examples / log-extension / src / __tests__ / acceptance / log.extension.acceptance.ts View on Github external
function createController() {
    class MyController {
      @get('/debug')
      @log(LOG_LEVEL.DEBUG)
      debug() {
        return 'debug called';
      }

      @get('/warn')
      @log(LOG_LEVEL.WARN)
      warn() {
        return 'warn called';
      }

      @get('/info')
      @log(LOG_LEVEL.INFO)
      info() {
        return 'info called';
      }

      @get('/error')
      @log(LOG_LEVEL.ERROR)
      error() {
        return 'error called';
      }
github strongloop / loopback4-example-shopping / src / controllers / home-page.controller.ts View on Github external
export class HomePageController {
  render: TemplateExecutor;

  constructor(
    @inject(PackageKey) private pkg: PackageInfo,
    @inject(RestBindings.Http.RESPONSE) private response: Response,
  ) {
    const html = fs.readFileSync(
      path.join(__dirname, '../../../public/index.html.template'),
      'utf-8',
    );
    this.render = template(html);
  }

  @get('/', {
    responses: {
      '200': {
        description: 'Home Page',
        content: {'text/html': {schema: {type: 'string'}}},
      },
    },
  })
  homePage() {
    const homePage = this.render(this.pkg);
    this.response
      .status(200)
      .contentType('html')
      .send(homePage);
  }
}

@loopback/openapi-v3

Decorators that annotate LoopBack artifacts with OpenAPI v3 metadata and utilities that transform LoopBack metadata to OpenAPI v3 specifications

MIT
Latest version published 30 days ago

Package Health Score

95 / 100
Full package analysis