8000 Problem passing multiple query parameters to resource type as an Object · Issue #180 · mulesoft/osprey · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.
This repository was archived by the owner on May 10, 2024. It is now read-only.
Problem passing multiple query parameters to resource type as an Object #180
Open
@Mukolajko

Description

@Mukolajko

Hi. I got issue on validation when trying to pass multiple query parameters to resource in object.

Here is an error that validator produces
{ code: 'SCALAR_PROHIBITED', message: 'Property \'queryParameters\' can not have scalar value' }

What's weird that if i pass single parameter everything works as expected.

Here is my raml code

/api/ier:
    type: {
      stx-get: {
        queryData: {
          test: {
            type: integer,
            description: some desc
          }
        },
        typeName : AnalyticsFeedsCount,
        desc: Get amount of available analytics feeds in IER server
      }
    }

And the resource part

stx-get:
  usage: Use this resourceType for GET routes
  get:
    queryParameters: <<queryData>>
    description: <<desc>>
    is:
      - hasResponseItem: {typeName: <<typeName>>}

If queryData have only single key it passes and if multiple it will fail with SCALAR_PROHIBITED message.

Now if i just write object in resourceType everything works.

stx-get:
  usage: Use this resourceType for GET routes
  get:
    queryParameters: {
      test: {
        type: integer,
        description: some desc
      },
      page: {
        type: string,
        required: false
      }
    }
    description: <<desc>>
    is:
      - hasResponseItem: {typeName: <<typeName>>}

When i try to debug. I found that raml-1-parser module causing this issue.

To be exactly dist/parser/ast.core/linter.js method validateBasicFlat
This code returns error:

if (node.lowLevel().value() != '~') {
                    if (!checkIfIncludeTagIsMissing(node, v, messageRegistry.SCALAR_PROHIBITED.code, false)) {
                        v.accept(createIssue1(messageRegistry.SCALAR_PROHIBITED, { propName: node.name() }, node));
                    }
                }

I just cant seem to understand what am i missing.
Query parameters allow object to be passed in, but for some reason when i pass it as an argument it fails.

Also when checking styling with https://github.com/raml2html/raml2html everything works fine with all approaches.

Thank you for help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0