Skip to content

[Annotations] When producer_resource_name is string and consumer_param is array, grammar.py is generated with a string #973

@NataliaDracheva

Description

@NataliaDracheva

Description

I have to specify Users list when I create a Thing entity. User id for the "Create Thing" request is taken from a "Create User" response. When I provide an annotation, grammar.py is generated in a way that puts just the id value and does not allow sending the list.

Steps to reproduce

My annotations.json file:

{
  "x-restler-global-annotations": [
    {
      "producer_endpoint": "/users",
      "producer_method": "POST",
      "producer_resource_name": "id",
      "consumer_endpoint": "/things",
      "consumer_method": "POST",
      "consumer_param": "/users/[0]"
    }
  ]
}

Generated grammar.py file:

    primitives.restler_static_string(""",
    "users":"""),
    primitives.restler_static_string(_users_post_id.reader(), quoted=False),

consumer_param_array.zip

Expected results

My system expects an array of user IDs (users: ["UserId"]) in the "CreateThing" request (item of an array, quoted).

Actual results

I see just users: UserID (simple unquoted value).

Environment details

Ubuntu 22.04, Python 3.10, .Net 8, Restler v3.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions