Skip to content

Commit

Permalink
genspeccia
Browse files Browse the repository at this point in the history
  • Loading branch information
oplekal committed Dec 9, 2024
1 parent b135faf commit 85326b8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
12 changes: 9 additions & 3 deletions eperusteet/eperusteet-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<!-- <springfox.version>2.7.0</springfox.version>-->
<springdoc.version>2.7.0</springdoc.version>
<surefire.version>3.2.2</surefire.version>
<swagger-maven-plugin-version>3.1.7</swagger-maven-plugin-version>
<swagger-maven-plugin-version>3.1.8</swagger-maven-plugin-version>
<jacoco.version>0.8.12</jacoco.version>
</properties>
<dependencies>
Expand Down Expand Up @@ -94,7 +94,13 @@
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<!-- <dependency>-->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
<version>1.8.0</version>
</dependency>

<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger2</artifactId>-->
<!-- <version>${springfox.version}</version>-->
Expand Down Expand Up @@ -984,7 +990,7 @@
</executions>
<configuration>
<apiDocsUrl>http://localhost:8080/eperusteet-service/api-docs</apiDocsUrl>
<outputFileName>eperusteet.json</outputFileName>
<outputFileName>eperusteet.spec.json</outputFileName>
<outputDir>${project.build.directory}/openapi</outputDir>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package fi.vm.sade.eperusteet.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.media.Schema;
import org.springdoc.core.customizers.OpenApiCustomiser;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import java.util.Map;

@Configuration
//@EnableSwagger2
@Profile("!test")
Expand Down Expand Up @@ -50,4 +55,28 @@ public OpenAPI springShopOpenAPI() {
.version("v3.0.0")
.license(new License().name("EUPL 1.1").url("https://interoperable-europe.ec.europa.eu/licence/european-union-public-licence-version-11-or-later-eupl")));
}

// @Bean
// public OpenApiCustomiser customOpenApi() {
// return openApi -> {
// Components components = openApi.getComponents();
// if (components != null && components.getSchemas() != null) {
// Map<String, Schema> schemas = components.getSchemas();
//
// for (Schema<?> schema : schemas.values()) {
// if (schema.getProperties() != null) {
// schema.getProperties().forEach((propertyName, propertySchema) -> {
// if (propertySchema instanceof Schema) {
// Schema<?> property = (Schema<?>) propertySchema;
//
// if ("array".equals(property.getType())) {
// property.setUniqueItems(null);
// }
// }
// });
// }
// }
// }
// };
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import fi.vm.sade.eperusteet.dto.util.LokalisoituTekstiDto;
import java.util.Date;

import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand All @@ -28,5 +30,6 @@ public class PerusteKevytDto {
private Reference perusteprojekti;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
// @Schema(type = "array")
private Set<SuoritustapaDto> suoritustavat;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import fi.vm.sade.eperusteet.dto.Reference;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
Expand All @@ -15,6 +16,7 @@
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(Include.NON_NULL)
@Schema(name = "PerusteenOsaViiteDto")
public class PerusteenOsaViiteDto<R extends PerusteenOsaDto> {

private Long id;
Expand Down Expand Up @@ -44,6 +46,7 @@ public Matala(PerusteenOsaDto.Laaja perusteenOsa) {
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Schema(name = "PuuPerusteenOsaDto")
public static class Puu<R extends PerusteenOsaDto, L extends Puu<R, L>> extends PerusteenOsaViiteDto<R> {
private List<L> lapset;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ springdoc.packagesToScan=fi.vm.sade.eperusteet.resource
springdoc.pathsToMatch=/api/**
springdoc.swagger-ui.disable-swagger-default-url=true
springdoc.swagger-ui.path=/swagger
springdoc.api-docs.path=/api-docs
springdoc.api-docs.path=/api-docs

#openapi.generator.maven.plugin.instantiationTypes=array=ArrayList

0 comments on commit 85326b8

Please sign in to comment.