How to use the @stoplight/types.HttpParamStyles.Label function in @stoplight/types

To help you get started, we’ve selected a few @stoplight/types 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 stoplightio / prism / packages / http / src / validator / deserializers / style / __tests__ / label.spec.ts View on Github external
it('returns true', () => {
        expect(labelStyleDeserializer.supports(HttpParamStyles.Label)).toBe(true);
      });
    });
github stoplightio / prism / packages / cli / src / util / __tests__ / paths.spec.ts View on Github external
it('generates label style', () => {
      assertRight(
        createExamplePath({
          id: '123',
          path: '/path/{p}',
          method: 'get',
          request: { path: [{ name: 'p', style: HttpParamStyles.Label, examples: [{ key: 'foo', value: 'test' }] }] },
          responses: [{ code: '200' }],
        }),
        r => expect(r).toEqual('/path/.test')
      );
    });
github stoplightio / prism / packages / cli / src / util / __tests__ / paths.spec.ts View on Github external
it('generates correct path', () => {
      assertRight(
        createExamplePath({
          id: '123',
          path: '/path/{p1}/{p2}/{p3}',
          method: 'get',
          request: {
            path: [
              { name: 'p1', style: HttpParamStyles.Simple, examples: [{ key: 'foo', value: 'test1' }] },
              { name: 'p2', style: HttpParamStyles.Label, examples: [{ key: 'foo', value: ['test1', 'test2'] }] },
              { name: 'p3', style: HttpParamStyles.Matrix, examples: [{ key: 'foo', value: ['test1', 'test2'] }] },
            ],
            query: [
              { name: 'q1', style: HttpParamStyles.Form, examples: [{ key: 'foo', value: 'test1' }] },
              {
                name: 'q2',
                style: HttpParamStyles.SpaceDelimited,
                examples: [{ key: 'foo', value: ['test1', 'test2'] }],
              },
              {
                name: 'q3',
                style: HttpParamStyles.PipeDelimited,
                examples: [{ key: 'foo', value: ['test1', 'test2'] }],
              },
              {
                name: 'q4',
github stoplightio / prism / packages / http / src / validator / deserializers / style / label.ts View on Github external
public supports(style: HttpParamStyles) {
    return style === HttpParamStyles.Label;
  }
github stoplightio / prism / packages / cli / src / util / paths.ts View on Github external
function createParamUriTemplate(name: string, style: HttpParamStyles, explode: boolean) {
  const starOrVoid = explode ? '*' : '';
  switch (style) {
    case HttpParamStyles.Simple:
      return E.right(`{${name}${starOrVoid}}`);

    case HttpParamStyles.Label:
      return E.right(`{.${name}${starOrVoid}}`);

    case HttpParamStyles.Matrix:
      return E.right(`{;${name}${starOrVoid}}`);

    default:
      return E.left(new Error(`Unsupported parameter style: ${style}`));
  }
}