typespec icon indicating copy to clipboard operation
typespec copied to clipboard

doc: fix incorrect example of `@statusCode`

Open mochi-yu opened this issue 2 years ago • 4 comments

Issue Description

There is a example of TypeSpec.http.@statusCode here. However, the property name is missing in this example. Due to this, the code did not work as expected.

op read(): {@statusCode: 200, @body pet: Pet}
op create(): {@statusCode: 201 | 202}

Instead, specifying the property name as follows made it work correctly:

op read(): {
  @statusCode _: 200;
  @body pet: Widget;
};
op create(): {
  @statusCode _: 201 | 202;
};

Fix Description

  • Corrected examples of TypeSpec.http.@statusCode in the reference and documentation.

mochi-yu avatar Apr 24 '24 16:04 mochi-yu

@microsoft-github-policy-service agree

mochi-yu avatar Apr 24 '24 16:04 mochi-yu

Dear Maintainer,

Thanks for this useful tool! I was using TypeSpec and found this incorrect example. I wanted to contribute to this tool, so I committed this fix and created a pull request. However, I do not have enough experience contributing to OSS projects. If I missed something, I would like you to fix it or support me.

mochi-yu avatar Apr 24 '24 17:04 mochi-yu

/azp run typespec - pr tools

timotheeguerin avatar Apr 24 '24 19:04 timotheeguerin

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Apr 24 '24 19:04 azure-pipelines[bot]

/azp run typespec - pr tools

timotheeguerin avatar Jun 03 '24 20:06 timotheeguerin

Azure Pipelines successfully started running 1 pipeline(s).

azure-pipelines[bot] avatar Jun 03 '24 20:06 azure-pipelines[bot]

:x: There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • :x:@typespec/http
Show changes

azure-sdk avatar Jun 03 '24 20:06 azure-sdk