Skip to content

[Bug]: HTTP should be explicit about incorrect usage of body/bodyRoot (linter, error, or else) #5993

Open
@lmazuel

Description

@lmazuel

Describe the bug

HTTP do not warn, refuse, or have linter rules about recursively using body or bodyRoot. It was discussed today with @markcowl and @timotheeguerin that this is not a valid pattern, therefore it's suggested that we refuse it.

This may happen unexpectidely when people are using template. Some template of Azure-core for instance include bodyRoot, and any usage of body would fall in this situation, and silently do nothing and be confusing for emitters.

It feels to me that HTTP should be explicit about its behavior, and this is not the case today.

Reproduction

@route("bodyRootWithBody")
op bodyRootWithBody(
  @bodyRoot _: {
    @body body: bytes;
  },
): void;

@route("bodyWithBody")
op bodyWithBody(
  @body _: {
    @body body: bytes;
  },
): void;

Checklist

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions