-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 272-openapi-issue-build-maps
- Loading branch information
Showing
10 changed files
with
425 additions
and
2 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
128 changes: 128 additions & 0 deletions
128
multiapi-engine/src/test/resources/openapigenerator/testIssueFaker/api-test.yml
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,128 @@ | ||
openapi: 3.0.2 | ||
info: | ||
title: Faker API Service | ||
version: "1.0" | ||
servers: | ||
- url: https://localhost/v1 | ||
paths: | ||
/faker/generate-schemas: | ||
post: | ||
tags: | ||
- SchemaGenerator | ||
operationId: generateSchema | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Configuration' | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/FakerSchema' | ||
'400': | ||
description: Bad Request | ||
'404': | ||
description: Not found | ||
|
||
components: | ||
schemas: | ||
Schema: | ||
type: object | ||
required: | ||
- subjectName | ||
- name | ||
properties: | ||
id: | ||
type: string | ||
subjectName: | ||
type: string | ||
name: | ||
type: string | ||
type: | ||
type: string | ||
original: | ||
type: boolean | ||
requiredFields: | ||
type: array | ||
items: | ||
type: string | ||
properties: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Field' | ||
definitions: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Field' | ||
FakerSchema: | ||
type: object | ||
required: | ||
- subjectName | ||
- name | ||
- value | ||
properties: | ||
id: | ||
type: string | ||
subjectName: | ||
type: string | ||
name: | ||
type: string | ||
type: | ||
type: string | ||
original: | ||
type: boolean | ||
requiredFields: | ||
type: array | ||
items: | ||
type: string | ||
properties: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/FakerField' | ||
definitions: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/FakerField' | ||
FakerField: | ||
type: object | ||
required: | ||
- name | ||
- type | ||
- value | ||
properties: | ||
name: | ||
type: string | ||
type: | ||
type: string | ||
value: | ||
type: object | ||
Field: | ||
type: object | ||
required: | ||
- name | ||
- type | ||
properties: | ||
name: | ||
type: string | ||
type: | ||
type: string | ||
|
||
Configuration: | ||
type: object | ||
properties: | ||
configuration: | ||
type: object | ||
additionalProperties: | ||
type: number | ||
example: | ||
"ES": 0.8 | ||
"US": 0.2 | ||
numberToGenerate: | ||
type: integer | ||
example: 100 | ||
schema: | ||
$ref: '#/components/schemas/Schema' |
49 changes: 49 additions & 0 deletions
49
multiapi-engine/src/test/resources/openapigenerator/testIssueFaker/assets/FakerApi.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,49 @@ | ||
package com.sngular.multifileplugin.testIssueFaker; | ||
|
||
import java.util.Optional; | ||
import java.util.List; | ||
import java.util.Map; | ||
import javax.validation.Valid; | ||
|
||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.Parameter; | ||
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 org.springframework.http.MediaType; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
import org.springframework.web.context.request.NativeWebRequest; | ||
|
||
import com.sngular.multifileplugin.testIssueFaker.model.ConfigurationDTO; | ||
import com.sngular.multifileplugin.testIssueFaker.model.FakerSchemaDTO; | ||
|
||
public interface FakerApi { | ||
|
||
/** | ||
* POST /faker/generate-schemas | ||
* @param configurationDTO (required) | ||
* @return OK; (status code 200) Bad Request; (status code 400) Not found; (status code 404) | ||
*/ | ||
|
||
@Operation( | ||
operationId = "generateSchema", | ||
tags = {"SchemaGenerator"}, | ||
responses = { | ||
@ApiResponse(responseCode = "200", description = "OK", content = @Content(mediaType = "application/json", schema = @Schema(implementation = FakerSchemaDTO.class))), | ||
@ApiResponse(responseCode = "400", description = "Bad Request"), | ||
@ApiResponse(responseCode = "404", description = "Not found") | ||
} | ||
) | ||
@RequestMapping( | ||
method = RequestMethod.POST, | ||
value = "/faker/generate-schemas", | ||
produces = {"application/json"} | ||
) | ||
|
||
default ResponseEntity<FakerSchemaDTO> generateSchema(@Parameter(name = "configurationDTO", description = "", required = true, schema = @Schema(description = "")) @Valid @RequestBody ConfigurationDTO configurationDTO) { | ||
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...ine/src/test/resources/openapigenerator/testIssueFaker/assets/model/ConfigurationDTO.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,33 @@ | ||
package com.sngular.multifileplugin.testIssueFaker.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.math.BigDecimal; | ||
import java.util.Map; | ||
import java.util.HashMap; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
@Data | ||
public class ConfigurationDTO { | ||
|
||
@JsonProperty(value ="configuration") | ||
private Map<String, BigDecimal> configuration = new HashMap<String, BigDecimal>(); | ||
|
||
@JsonProperty(value ="numberToGenerate") | ||
private Integer numberToGenerate; | ||
|
||
@JsonProperty(value ="schema") | ||
private SchemaDTO schema; | ||
|
||
|
||
@Builder | ||
@Jacksonized | ||
private ConfigurationDTO(Map<String, BigDecimal> configuration, Integer numberToGenerate, SchemaDTO schema) { | ||
this.configuration = configuration; | ||
this.numberToGenerate = numberToGenerate; | ||
this.schema = schema; | ||
|
||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
...engine/src/test/resources/openapigenerator/testIssueFaker/assets/model/FakerFieldDTO.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,33 @@ | ||
package com.sngular.multifileplugin.testIssueFaker.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
@Data | ||
public class FakerFieldDTO { | ||
|
||
@JsonProperty(value ="value") | ||
private Object value; | ||
|
||
@JsonProperty(value ="type") | ||
@NonNull | ||
private String type; | ||
|
||
@JsonProperty(value ="name") | ||
@NonNull | ||
private String name; | ||
|
||
|
||
@Builder | ||
@Jacksonized | ||
private FakerFieldDTO(Object value, @NonNull String type, @NonNull String name) { | ||
this.value = value; | ||
this.type = type; | ||
this.name = name; | ||
|
||
} | ||
|
||
} |
55 changes: 55 additions & 0 deletions
55
...ngine/src/test/resources/openapigenerator/testIssueFaker/assets/model/FakerSchemaDTO.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,55 @@ | ||
package com.sngular.multifileplugin.testIssueFaker.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.List; | ||
import java.util.ArrayList; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NonNull; | ||
import lombok.extern.jackson.Jacksonized; | ||
|
||
@Data | ||
public class FakerSchemaDTO { | ||
|
||
@JsonProperty(value ="type") | ||
private String type; | ||
|
||
@JsonProperty(value ="properties") | ||
private List<FakerFieldDTO> properties = new ArrayList<FakerFieldDTO>(); | ||
|
||
@JsonProperty(value ="name") | ||
@NonNull | ||
private String name; | ||
|
||
@JsonProperty(value ="id") | ||
private String id; | ||
|
||
@JsonProperty(value ="definitions") | ||
private List<FakerFieldDTO> definitions = new ArrayList<FakerFieldDTO>(); | ||
|
||
@JsonProperty(value ="subjectName") | ||
@NonNull | ||
private String subjectName; | ||
|
||
@JsonProperty(value ="requiredFields") | ||
private List<String> requiredFields = new ArrayList<String>(); | ||
|
||
@JsonProperty(value ="original") | ||
private Boolean original; | ||
|
||
|
||
@Builder | ||
@Jacksonized | ||
private FakerSchemaDTO(String type, List<FakerFieldDTO> properties, @NonNull String name, String id, List<FakerFieldDTO> definitions, @NonNull String subjectName, List<String> requiredFields, Boolean original) { | ||
this.type = type; | ||
this.properties = properties; | ||
this.name = name; | ||
this.id = id; | ||
this.definitions = definitions; | ||
this.subjectName = subjectName; | ||
this.requiredFields = requiredFields; | ||
this.original = original; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.