Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oppgareder swagger til openapi 3 #1164

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Interne henvendelser kan sendes via Slack i kanalen #vtp-chatten
For utvikling på VTP benytt oppsett for å starte server gjennom IDE.
I verdikjedetester benyttes oftest Docker-image av VTP. Dette bygges i VTP sin pipeline.

Når applikasjonen har startet blir Swagger tilgjengelig på http://localhost:8060/swagger/
Når applikasjonen har startet blir Swagger konfigurasjonen tilgjengelig på http://localhost:8060/rest/openapi.json
Swagger-ui kan startet vi docker-compose oppsett i /swagger-ui og blir da tilgjengelig på http://localhost:8061/swagger/

#### Starte backend-server via IDE
* IntelliJ må konfigureres med å sette classpath of module til server, og sette working directory til `$MODULE_WORKING_DIR$` i run/debug-konfiguration.
Expand Down
6 changes: 2 additions & 4 deletions kontrakter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
<groupId>no.nav.foreldrepenger.vtp</groupId>
<artifactId>testmodell</artifactId>
</dependency>

<!-- 3dje parts biblioteker -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@ApiModel(value = "DødfødselhendelseDto")
@Schema(name = "DødfødselhendelseDto")
@JsonIgnoreProperties(ignoreUnknown = true)
public record DødfødselhendelseDto(@ApiModelProperty String endringstype,
@ApiModelProperty String tidligereHendelseId,
@ApiModelProperty String fnr,
@ApiModelProperty LocalDate doedfoedselsdato) implements PersonhendelseDto {
public record DødfødselhendelseDto(@Schema String endringstype,
@Schema String tidligereHendelseId,
@Schema String fnr,
@Schema LocalDate doedfoedselsdato) implements PersonhendelseDto {
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@ApiModel(value = "DødshendelseDto")

@Schema(name = "DødshendelseDto")
@JsonIgnoreProperties(ignoreUnknown = true)
public record DødshendelseDto(@ApiModelProperty String endringstype,
@ApiModelProperty String tidligereHendelseId,
@ApiModelProperty String fnr,
@ApiModelProperty LocalDate doedsdato) implements PersonhendelseDto {
public record DødshendelseDto(@Schema String endringstype,
@Schema String tidligereHendelseId,
@Schema String fnr,
@Schema LocalDate doedsdato) implements PersonhendelseDto {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@ApiModel(value = "FamilierelasjonHendelseDto")
@Schema(name = "FamilierelasjonHendelseDto")
@JsonIgnoreProperties(ignoreUnknown = true)
public record FamilierelasjonHendelseDto(@ApiModelProperty String endringstype,
@ApiModelProperty String fnr,
@ApiModelProperty String relatertPersonsFnr,
@ApiModelProperty String relatertPersonsRolle,
@ApiModelProperty String minRolleForPerson) implements PersonhendelseDto {
public record FamilierelasjonHendelseDto(@Schema String endringstype,
@Schema String fnr,
@Schema String relatertPersonsFnr,
@Schema String relatertPersonsRolle,
@Schema String minRolleForPerson) implements PersonhendelseDto {

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@ApiModel(value = "FødselshendelseDto")
@Schema(name = "FødselshendelseDto")
@JsonIgnoreProperties(ignoreUnknown = true)
public record FødselshendelseDto(@ApiModelProperty String endringstype,
@ApiModelProperty String tidligereHendelseId,
@ApiModelProperty String fnrMor,
@ApiModelProperty String fnrFar,
@ApiModelProperty String fnrBarn,
@ApiModelProperty @JsonProperty("foedselsdato") LocalDate fødselsdato) implements PersonhendelseDto {
public record FødselshendelseDto(@Schema String endringstype,
@Schema String tidligereHendelseId,
@Schema String fnrMor,
@Schema String fnrFar,
@Schema String fnrBarn,
@Schema @JsonProperty("foedselsdato") LocalDate fødselsdato) implements PersonhendelseDto {
}

4 changes: 0 additions & 4 deletions mocks/arbeidsforhold-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,5 @@
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import no.nav.foreldrepenger.vtp.testmodell.inntektytelse.arbeidsforhold.Arbeidsforhold;
import no.nav.foreldrepenger.vtp.testmodell.inntektytelse.arbeidsforhold.Arbeidsforholdstype;
import no.nav.foreldrepenger.vtp.testmodell.repo.TestscenarioBuilderRepository;

@Path("aareg-services/api/v1/arbeidstaker")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@Api(tags = {"AARegister Rest"})
@Tag(name = "AARegister Rest")
public class AaregRSV1Mock {

private static final Logger LOG = LoggerFactory.getLogger(AaregRSV1Mock.class);
Expand All @@ -49,15 +49,14 @@ public AaregRSV1Mock(@Context TestscenarioBuilderRepository scenarioRepository)
@SuppressWarnings("unused")
@GET
@Path("/arbeidsforhold")
@ApiOperation(value = "Henter arbeidsforhold for en person")
@ApiImplicitParams({
@ApiImplicitParam(name = HEADER_NAV_PERSONIDENT, required = true, dataType = "string", paramType = "header"),
@ApiImplicitParam(name = QPRM_FOM, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = QPRM_TOM, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = ARBEIDSFORHOLDTYPE, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "sporingsinformasjon", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = QPRM_REGELVERK, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "historikk", dataType = "string", paramType = "query")
@Operation(description = "Henter arbeidsforhold for en person", parameters = {
@Parameter(name = HEADER_NAV_PERSONIDENT, required = true, in = ParameterIn.HEADER),
@Parameter(name = QPRM_FOM, in = ParameterIn.QUERY),
@Parameter(name = QPRM_TOM, in = ParameterIn.QUERY),
@Parameter(name = ARBEIDSFORHOLDTYPE, in = ParameterIn.QUERY),
@Parameter(name = "sporingsinformasjon", in = ParameterIn.QUERY),
@Parameter(name = QPRM_REGELVERK, in = ParameterIn.QUERY),
@Parameter(name = "historikk", in = ParameterIn.QUERY)
})
public List<ArbeidsforholdRS> hentArbeidsforholdFor(@Context HttpHeaders httpHeaders, @Context UriInfo uriInfo) {
var ident = httpHeaders.getHeaderString(HEADER_NAV_PERSONIDENT);
Expand Down
4 changes: 0 additions & 4 deletions mocks/axsys-enhetstilgang-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http-spi</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import no.nav.foreldrepenger.vtp.testmodell.repo.TestscenarioBuilderRepository;

@Path("axsys-enhetstilgang/api/v1/tilgang/")
@Produces(MediaType.APPLICATION_JSON)
@Api(tags = {"Axsys/enhetstilgang"})
@Tag(name = "Axsys/enhetstilgang")
public class AxsysEnhetstilgangMock {

private static final Logger LOG = LoggerFactory.getLogger(AxsysEnhetstilgangMock.class);
Expand All @@ -34,7 +34,7 @@ public class AxsysEnhetstilgangMock {
@SuppressWarnings("unused")
@GET
@Path("/{ident}")
@ApiOperation(value = "Henter enhetstilgang for saksbehandlerident")
@Operation(description = "Henter enhetstilgang for saksbehandlerident")
public AxsysTilgangDto hentOrganisasjonAdresse(@PathParam("ident") String ident,
@Context HttpHeaders httpHeaders,
@Context UriInfo uriInfo) {
Expand Down
4 changes: 0 additions & 4 deletions mocks/dkif-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
<artifactId>jersey-common</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import no.nav.foreldrepenger.vtp.testmodell.repo.TestscenarioBuilderRepository;
import no.nav.foreldrepenger.vtp.testmodell.repo.impl.BasisdataProviderFileImpl;
import no.nav.foreldrepenger.vtp.testmodell.repo.impl.TestscenarioRepositoryImpl;

@Api(tags = {"digdir-krr-proxy"})
@Tag(name = "digdir-krr-proxy")
@Path("/digdir")
public class DigdirKrrProxyMock {

Expand All @@ -33,7 +33,7 @@ public DigdirKrrProxyMock() {
@Path("/rest/v1/person")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "", notes = "Henter kontaktinformasjon for person")
@Operation(description = "Henter kontaktinformasjon for person")
public Response hentKontaktinformasjon(@HeaderParam(HEADER_NAV_PERSONIDENT) @NotNull String fnr,
@HeaderParam(AUTHORIZATION) String authorizationHeader) {
var spraak = hentUtForetrukketSpråkFraBruker(fnr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import no.nav.foreldrepenger.vtp.testmodell.personopplysning.PersonIndeks;
import no.nav.foreldrepenger.vtp.testmodell.personopplysning.Personopplysninger;
import no.nav.foreldrepenger.vtp.testmodell.repo.TestscenarioBuilderRepository;
import no.nav.foreldrepenger.vtp.testmodell.repo.impl.BasisdataProviderFileImpl;
import no.nav.foreldrepenger.vtp.testmodell.repo.impl.TestscenarioRepositoryImpl;

@Deprecated(forRemoval = true)
@Api(tags = {"dkif"})
@Tag(name = "dkif")
@Path("/api/v1/personer")
public class DigitalKontaktinformasjonMock {
private static final Logger LOG = LoggerFactory.getLogger(DigitalKontaktinformasjonMock.class);
Expand All @@ -39,7 +39,7 @@ public DigitalKontaktinformasjonMock() {
@Path("/kontaktinformasjon")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "", notes = "Henter kontaktinformasjon for bruker")
@Operation(description = "Henter kontaktinformasjon for bruker")
public DigitalKontaktinfoResponsDto hentKontaktinformasjon(@HeaderParam(HEADER_NAV_PERSONIDENT) String fnr,
@HeaderParam(AUTHORIZATION) String authorizationHeader,
@HeaderParam(NAV_CALLID) String navCallid,
Expand Down
8 changes: 2 additions & 6 deletions mocks/dokdist-mock/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,13 @@
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<!-- activate the plugin -->
<plugin>
<groupId>io.swagger</groupId>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
Expand All @@ -37,7 +33,7 @@
</goals>
<configuration>
<!-- specify the swagger yaml -->
<inputSpec>${basedir}/src/main/swagger/swagger.json</inputSpec>
<inputSpec>${basedir}/src/main/swagger/swagger.yml</inputSpec>
<!--<configHelp>true</configHelp> -->
<language>jaxrs-cxf-cdi</language>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import no.nav.dokdistfordeling.generated.model.DistribuerJournalpostRequestToModel;
import no.nav.dokdistfordeling.generated.model.DistribuerJournalpostResponseToModel;

@Api(tags = {"Dokdist"})
@Tag(name = "Dokdist")
@Path("dokdist/v1/distribuerjournalpost")
public class DokdistfordelingMock {
private static final Logger LOG = LoggerFactory.getLogger(DokdistfordelingMock.class);

@POST
@ApiOperation(value = "distribuer journalpost")
@Operation(description = "distribuer journalpost")
public Response distribuerjournalpost(DistribuerJournalpostRequestToModel request) {
LOG.info("Distribuer journalpost request: [{}]", request);

Expand Down
1 change: 0 additions & 1 deletion mocks/dokdist-mock/src/main/swagger/swagger.json

This file was deleted.

Loading