Skip to content

Commit

Permalink
GH-209 Add more object examples on a reference side
Browse files Browse the repository at this point in the history
  • Loading branch information
dzikoysk committed Jan 29, 2024
1 parent 0d81c03 commit ddc6ab2
Showing 1 changed file with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,25 @@ public String getFormattedMessage() {
return new String[] { timestamp };
}

// should contain dedicated foo example
@OpenApiExample(objects = {
@OpenApiExampleProperty(name = "name", value = "Margot Robbie"),
@OpenApiExampleProperty(name = "link", value = "https://www.youtube.com/watch?v=dQw4w9WgXcQ")
})
public @NotNull Foo getExampleFoo() {
return new Foo();
}

// should contain object example
@OpenApiExample(objects = {
@OpenApiExampleProperty(name = "name", value = "Margot Robbie"),
@OpenApiExampleProperty(name = "link", value = "https://www.youtube.com/watch?v=dQw4w9WgXcQ")
})
public @NotNull Object getExampleObject() {
return new String[] { timestamp };
}

// should contain objects example
@OpenApiExample(objects = {
@OpenApiExampleProperty(name = "Barbie", objects = {
@OpenApiExampleProperty(name = "name", value = "Margot Robbie"),
Expand Down Expand Up @@ -381,19 +399,10 @@ public static String getStatic() {
}

static final class Foo {

private String property;
private String link;

public String getProperty() {
return property;
}

@OpenApiExample("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
public String getLink() {
return link;
return "";
}

}

// subtype
Expand Down

0 comments on commit ddc6ab2

Please sign in to comment.