-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from funkyFangs/SC-3-update-annotations-to-be-c…
…ompile-only SC-3: update annotations to be compile only
- Loading branch information
Showing
16 changed files
with
329 additions
and
331 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
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
...tomizer/src/main/java/io/funky/fangs/springdoc/customizer/model/ExampleDetailsRecord.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,32 @@ | ||
package io.funky.fangs.springdoc.customizer.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.funky.fangs.springdoc.customizer.annotation.ExampleDetails; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; | ||
import static java.util.Collections.emptyList; | ||
|
||
/** | ||
* | ||
* @param name | ||
* @param summary | ||
* @param description | ||
* @param targets | ||
* @see ExampleDetails | ||
*/ | ||
public record ExampleDetailsRecord(String name, String summary, String description, | ||
@JsonInclude(NON_EMPTY) Collection<ExampleTargetRecord> targets) { | ||
public ExampleDetailsRecord(String name, String summary, String description, | ||
Collection<ExampleTargetRecord> targets) { | ||
this.name = name; | ||
this.summary = summary; | ||
this.description = description; | ||
this.targets = Optional.ofNullable(targets) | ||
.map(List::copyOf) | ||
.orElse(emptyList()); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...stomizer/src/main/java/io/funky/fangs/springdoc/customizer/model/ExampleMethodRecord.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,19 @@ | ||
package io.funky.fangs.springdoc.customizer.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; | ||
import static java.util.Collections.emptyList; | ||
|
||
public record ExampleMethodRecord(String name, @JsonInclude(NON_EMPTY) Collection<ExampleTypeRecord> types) { | ||
public ExampleMethodRecord(String name, Collection<ExampleTypeRecord> types) { | ||
this.name = name; | ||
this.types = Optional.ofNullable(types) | ||
.map(List::copyOf) | ||
.orElse(emptyList()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...stomizer/src/main/java/io/funky/fangs/springdoc/customizer/model/ExampleTargetRecord.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,25 @@ | ||
package io.funky.fangs.springdoc.customizer.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.funky.fangs.springdoc.customizer.annotation.ExampleTarget; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; | ||
import static java.util.Collections.emptyList; | ||
|
||
/** | ||
* @param controller | ||
* @param methods | ||
* @see ExampleTarget | ||
*/ | ||
public record ExampleTargetRecord(String controller, @JsonInclude(NON_EMPTY) Collection<ExampleMethodRecord> methods) { | ||
public ExampleTargetRecord(String controller, Collection<ExampleMethodRecord> methods) { | ||
this.controller = controller; | ||
this.methods = Optional.ofNullable(methods) | ||
.map(List::copyOf) | ||
.orElse(emptyList()); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...customizer/src/main/java/io/funky/fangs/springdoc/customizer/model/ExampleTypeRecord.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,29 @@ | ||
package io.funky.fangs.springdoc.customizer.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import io.funky.fangs.springdoc.customizer.annotation.ExampleType.Type; | ||
import org.springframework.http.HttpStatus; | ||
|
||
import java.util.Collection; | ||
import java.util.EnumSet; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; | ||
import static java.util.Collections.emptySet; | ||
import static java.util.Collections.unmodifiableSet; | ||
import static java.util.function.Predicate.not; | ||
|
||
public record ExampleTypeRecord(Type type, @JsonInclude(NON_EMPTY) Collection<String> mediaTypes, | ||
@JsonInclude(NON_EMPTY) Collection<HttpStatus> responses) { | ||
public ExampleTypeRecord(Type type, Collection<String> mediaTypes, Collection<HttpStatus> responses) { | ||
this.type = type; | ||
this.mediaTypes = Optional.ofNullable(mediaTypes) | ||
.map(Set::copyOf) | ||
.orElse(emptySet()); | ||
this.responses = Optional.ofNullable(responses) | ||
.filter(not(Collection::isEmpty)) | ||
.map(collection -> unmodifiableSet(EnumSet.copyOf(collection))) | ||
.orElse(unmodifiableSet(EnumSet.noneOf(HttpStatus.class))); | ||
} | ||
} |
Oops, something went wrong.