saunter icon indicating copy to clipboard operation
saunter copied to clipboard

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

Open jdeusto opened this issue 4 years ago • 3 comments

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.

jdeusto avatar Jun 24 '21 09:06 jdeusto

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

m-wild avatar Jul 19 '21 04:07 m-wild

Ok, I will try it. Thanks for reply!

jdeusto avatar Jul 19 '21 10:07 jdeusto

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?

MarkiEC13 avatar Jan 12 '22 13:01 MarkiEC13