Skip to content

Releases: openapi-processor/openapi-parser

2025.4

07 Sep 14:56
Compare
Choose a tag to compare

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.20.0

io-snakeyaml

updated dependencies

  • updated org.yaml:snakeyaml to 2.5

2025.3

09 Jun 08:27
Compare
Choose a tag to compare

OpenAPI parser

Added new API to retrieve the document URI of the document in which the current object is defined.

@Experimental
public URI getDocumentUri()

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.19.0

2025.2

09 Mar 09:55
Compare
Choose a tag to compare

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.18.3

io-snakeyaml

updated dependencies

  • updated org.yaml:snakeyaml to 2.4.0

2025.1

01 Feb 17:06
Compare
Choose a tag to compare

openapi-parser 3.0/3.1

bundling

OpenApiResult has a new bundle() method to bundle a multi-file OpenAPI document.

/**
 * Bundle the document, i.e. merge a multi-file document into a single file document. The bundled document has to
 * be parsed to navigate its OpenAPI model.
 *
 * @return a raw bundled copy of the OpenAPI document.
 */
@Experimental
Map<String, Object> bundle();

It can be used like this:

// kotlin
import io.openapiparser.model.v31.OpenApi
import io.openapiprocessor.jsonschema.reader.UriReader
import io.openapiprocessor.jsonschema.schema.DocumentLoader
import io.openapiprocessor.jsonschema.schema.DocumentStore
import io.openapiprocessor.snakeyaml.SnakeYamlConverter
import java.net.URI

"bundle example" {
    val loader = DocumentLoader(UriReader(), SnakeYamlConverter())

    // parse a multi file OpeAPI document (from resources)
    val originalDocs = DocumentStore()
    val originalParser = OpenApiParser(originalDocs, loader)
    val originalResult = originalParser.parse("/original/openapi.yaml")

    // bundle the OpenAPI, i.e. move $ref content to "components.schemas" and friends if the
    // ref points to a different file. The original document is not touched.
    val bundled = originalResult.bundle()

    // parse the bundled document (this creates a reference map for ref lookups) to navigate
    // its OpenAPI model.
    val bundledDocs = DocumentStore()
    val bundledParser = OpenApiParser(bundledDocs, loader)
    val bundledResult = bundledParser.parse(URI.create("/original/openapi.yaml"), bundled)

    val api = bundledResult.getModel(OpenApi::class.java)
    val summary = api.info.summary

    // We could use the same document store, but it would override the original (root) document
    // if we use the same id (in this case file name). We can use a different id to avoid that.
    //val bundledParser = OpenApiParser(originalDocs, loader)
    //val bundledResult = bundledParser.parse(URI.create("/bundled/openapi.yaml"), bundled)
}

writing an OpenAPI document

OpenApiResult has a new write(Writer writer) method to write a single-file OpenAPI document.

/**
 * Write the document. This will produce useful results only if the document is a single file document. Bundling
 * can be used to create a single file document.
 *
 * @param writer the target writer
 */
@Experimental
void write(Writer writer) throws IOException;

Based on jackson (io-jackson library) or snakeyaml (io-snakeyaml) an OpenAPI document can be written like this:

// kotlin
import io.openapiprocessor.jackson.JacksonJsonWriter
import io.openapiprocessor.jackson.JacksonYamlWriter
import io.openapiprocessor.snakeyaml.SnakeYamlWriter

// write an OpenAPI document. Use the alternative constructor to configure jackson or snakeyaml specific formatting.
val out = StringWriter()
val writer = JacksonYamlWriter(out)
//val writer = SnakeYamlWriter(out)
//val writer = JacksonJsonWriter(out)

openApiResult.write(writer)

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.18.2

2024.5

03 Nov 17:07
Compare
Choose a tag to compare

openapi-parser 3.0/3.1

#114, fix

  • in OpenAPI 3.1 exclusiveMinimum & excusiveMaximum are numbers and not booleans.

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.18.1

2024.4

29 Sep 13:43
Compare
Choose a tag to compare

openapi-parser 3.0/3.1

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.18.0

io-snakeyaml

updated dependencies

  • updated org.snakeyaml:snakeyaml to 2.13.0

2024.3

09 May 15:49
Compare
Choose a tag to compare

openapi-parser 3.0/3.1

new

  • resolve response $ref, i.e. added public Response getRefObject () method to Response

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.17.1.

2024.2

24 Mar 16:23
Compare
Choose a tag to compare

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.17.0.

2024.1

21 Jan 17:48
Compare
Choose a tag to compare

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.16.1 and a couple of other dependencies

2023.6

19 Nov 15:01
Compare
Choose a tag to compare

io-jackson

updated dependencies

  • updated com.fasterxml.jackson:jackson-* to 2.16.0