Skip to content

Commit 279fb5b

Browse files
committed
$ref loop test
1 parent b2582cc commit 279fb5b

File tree

6 files changed

+143
-2
lines changed

6 files changed

+143
-2
lines changed

src/testInt/groovy/com/github/hauner/openapi/processor/ProcessorPendingTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import org.junit.Ignore
2020
import org.junit.runner.RunWith
2121
import org.junit.runners.Parameterized
2222

23-
@Ignore
23+
//@Ignore
2424
@RunWith(Parameterized)
2525
class ProcessorPendingTest extends ProcessorTestBase {
2626

2727
@Parameterized.Parameters(name = "{0}")
2828
static Collection<TestSet> sources () {
2929
return [
30-
new TestSet(name: 'response-content-multiple')
30+
new TestSet(name: 'ref-loop')
3131
]
3232
}
3333

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+
* DO NOT EDIT.
4+
*/
5+
6+
package generated.api;
7+
8+
import generated.model.Foo;
9+
import generated.model.Self;
10+
import org.springframework.http.ResponseEntity;
11+
import org.springframework.web.bind.annotation.GetMapping;
12+
13+
public interface Api {
14+
15+
@GetMapping(
16+
path = "/self-reference",
17+
produces = {"application/json"})
18+
ResponseEntity<Self> getSelfReference();
19+
20+
@GetMapping(
21+
path = "/nested-self-reference",
22+
produces = {"application/json"})
23+
ResponseEntity<Foo> getNestedSelfReference();
24+
25+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+
* DO NOT EDIT.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
public class Bar {
11+
12+
@JsonProperty("parent")
13+
private Foo parent;
14+
15+
public Foo getParent() {
16+
return parent;
17+
}
18+
19+
public void setParent(Foo parent) {
20+
this.parent = parent;
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+
* DO NOT EDIT.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
public class Foo {
11+
12+
@JsonProperty("child")
13+
private Bar child;
14+
15+
public Bar getChild() {
16+
return child;
17+
}
18+
19+
public void setChild(Bar child) {
20+
this.child = child;
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+
* DO NOT EDIT.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
public class Self {
11+
12+
@JsonProperty("self")
13+
private Self self;
14+
15+
public Self getSelf() {
16+
return self;
17+
}
18+
19+
public void setSelf(Self self) {
20+
this.self = self;
21+
}
22+
23+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
openapi: 3.0.2
2+
info:
3+
title: test $ref loop
4+
version: 1.0.0
5+
6+
paths:
7+
8+
/self-reference:
9+
get:
10+
responses:
11+
'200':
12+
description: none
13+
content:
14+
application/json:
15+
schema:
16+
$ref: '#/components/schemas/Self'
17+
18+
/nested-self-reference:
19+
get:
20+
responses:
21+
'200':
22+
description: none
23+
content:
24+
application/json:
25+
schema:
26+
$ref: '#/components/schemas/Foo'
27+
28+
components:
29+
schemas:
30+
31+
Self:
32+
type: object
33+
properties:
34+
self:
35+
$ref: '#/components/schemas/Self'
36+
37+
Foo:
38+
type: object
39+
properties:
40+
child:
41+
$ref: '#/components/schemas/Bar'
42+
43+
Bar:
44+
type: object
45+
properties:
46+
parent:
47+
$ref: '#/components/schemas/Foo'

0 commit comments

Comments
 (0)