-
Notifications
You must be signed in to change notification settings - Fork 27
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 #58 from justin-tay/openapi3_elide-7.x
Update to use OpenAPI 3 and refactor
- Loading branch information
Showing
26 changed files
with
324 additions
and
84 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
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,40 @@ | ||
package example.controllers; | ||
|
||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import io.swagger.v3.oas.annotations.tags.Tags; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Tags(value = { @Tag(name = "hello", description = "Say hello.") }) | ||
@RestController | ||
public class HelloController { | ||
@Builder | ||
@AllArgsConstructor | ||
@Schema(title= "Hello", description = "The hello response.") | ||
public static class HelloResource { | ||
@Getter | ||
private String text; | ||
@Getter | ||
private String language; | ||
} | ||
|
||
@GetMapping(value = "/hello", produces = MediaType.APPLICATION_JSON_VALUE) | ||
@ApiResponses( | ||
@ApiResponse( | ||
responseCode = "200", | ||
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, | ||
schema = @Schema(implementation = HelloResource.class)))) | ||
public ResponseEntity<HelloResource> hello() { | ||
return ResponseEntity.ok(HelloResource.builder().text("Hello").language("English").build()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright 2019, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package example.models.v1; | ||
|
||
import com.yahoo.elide.annotation.Include; | ||
import com.yahoo.elide.graphql.subscriptions.annotations.Subscription; | ||
import com.yahoo.elide.graphql.subscriptions.annotations.SubscriptionField; | ||
|
||
import lombok.Data; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Include(name = "groupV1", description = "Artifact group.", friendlyName = "GroupV1") | ||
@Table(name = "artifactgroup") | ||
@Entity | ||
@Subscription | ||
@Data | ||
public class ArtifactGroupV1 { | ||
@Id | ||
private String name = ""; | ||
|
||
@SubscriptionField | ||
private String commonName = ""; | ||
|
||
@SubscriptionField | ||
private String description = ""; | ||
|
||
@SubscriptionField | ||
@OneToMany(mappedBy = "group") | ||
private List<ArtifactProductV1> products = new ArrayList<>(); | ||
} |
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,34 @@ | ||
/* | ||
* Copyright 2019, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package example.models.v1; | ||
|
||
import com.yahoo.elide.annotation.Include; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Include(rootLevel = false, name = "productV1", description = "Artifact product.", friendlyName = "ProductV1") | ||
@Table(name = "artifactproduct") | ||
@Entity | ||
public class ArtifactProductV1 { | ||
@Id | ||
private String name = ""; | ||
|
||
private String commonName = ""; | ||
|
||
private String description = ""; | ||
|
||
@ManyToOne | ||
private ArtifactGroupV1 group = null; | ||
|
||
@OneToMany(mappedBy = "artifact") | ||
private List<ArtifactVersionV1> versions = new ArrayList<>(); | ||
} |
Oops, something went wrong.