-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue: #160
- Loading branch information
Showing
45 changed files
with
2,004 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...src/main/java/com/github/muehmar/gradle/openapi/typemappingwithconversion/CustomList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.github.muehmar.gradle.openapi.typemappingwithconversion; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
public class CustomList<T> { | ||
private final List<T> list; | ||
|
||
public CustomList(List<T> list) { | ||
this.list = list; | ||
} | ||
|
||
public static <T> CustomList<T> fromList(List<T> list) { | ||
return new CustomList<>(list); | ||
} | ||
|
||
public static <T> CustomList<T> emptyCustomList() { | ||
return customList(); | ||
} | ||
|
||
@SafeVarargs | ||
public static <T> CustomList<T> customList(T... items) { | ||
return new CustomList<>(Arrays.asList(items)); | ||
} | ||
|
||
public List<T> asList() { | ||
return list; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
final CustomList<?> that = (CustomList<?>) o; | ||
return Objects.equals(list, that.list); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(list); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CustomList{" + "list=" + list + '}'; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...c/main/java/com/github/muehmar/gradle/openapi/typemappingwithconversion/CustomString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.github.muehmar.gradle.openapi.typemappingwithconversion; | ||
|
||
import java.util.Objects; | ||
|
||
public class CustomString { | ||
private final String value; | ||
|
||
public static CustomString fromString(String value) { | ||
return new CustomString(value); | ||
} | ||
|
||
public CustomString(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
final CustomString that = (CustomString) o; | ||
return Objects.equals(value, that.value); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hashCode(value); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CustomString{" + "value='" + value + '\'' + '}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
openapi: "3.0.0" | ||
info: { } | ||
|
||
paths: { } | ||
|
||
components: | ||
schemas: | ||
|
||
FullObject: | ||
oneOf: | ||
- $ref: '#/components/schemas/Admin' | ||
- $ref: '#/components/schemas/User' | ||
|
||
NestedFullObject: | ||
required: | ||
- amount | ||
anyOf: | ||
- $ref: '#/components/schemas/FullObject' | ||
- $ref: '#/components/schemas/Member' | ||
properties: | ||
amount: | ||
type: integer | ||
|
||
User: | ||
required: | ||
- type | ||
- username | ||
properties: | ||
type: | ||
type: string | ||
username: | ||
type: string | ||
|
||
Admin: | ||
required: | ||
- type | ||
- adminname | ||
properties: | ||
type: | ||
type: string | ||
adminname: | ||
type: string | ||
nullable: true | ||
|
||
Member: | ||
required: | ||
- type | ||
- membername | ||
properties: | ||
type: | ||
type: string | ||
membername: | ||
type: string | ||
|
Oops, something went wrong.