asyncapi / saunter

Saunter is a code-first AsyncAPI documentation generator for dotnet.
https://www.asyncapi.com/
MIT License
204 stars 58 forks source link

Is it possible to add automatically request examples for testing asyncAPI? #99

Open jorgeromeral opened 3 years ago

jorgeromeral commented 3 years ago

Hi evryone, I wonder, if there is any option to add examples to autogenerated AsyncAPI document. It would be very useful to be able to add them using decorators (swagger-like) to have more complete APIs definitions when importing them into other tools such as Microcks (API listing, mocking and testing tool). Thanks.

m-wild commented 3 years ago

This is partially supported by the <example> XML tag. It will use that as an example in the property definition.

/// <example>
/// Bar
/// <example>
public string Foo { get; set; }

Will result in

type: string
example: "Bar"

This is not as strong as full examples for different scenarios, but it should be a good start

jorgeromeral commented 3 years ago

Ok, I will try it. Thanks for reply!

MarkiEC13 commented 2 years ago

This is partially supported by the <example> XML tag. It will use that as an example in the property definition.

/// <example>
/// Bar
/// <example>
public string Foo { get; set; }

Will result in

type: string
example: "Bar"

This is not as strong as full examples for different scenarios, but it should be a good start

This generates the json key as follows,

type: string
x-example: "Bar"

Shouldn't it be "example" instead? I don't see it reflects the UI when the key is "x-example". Am I missing something?