You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since swagger-parser 2.1.24, schemas from one OpenAPIParser.readLocation() call can contaminate a subsequent call in the same JVM. This causes cross-module schema contamination when using openapi-generator-maven-plugin with mvnd (Maven Daemon) and parallel builds (-T1C).
The issue was introduced by two changes in 2.1.24:
Two independent Maven modules define schemas with case-near-colliding names:
Module A: CountryDto (fields: identifier, label)
Module B: CountryDTO (fields: code, name)
After several builds with a warm mvnd daemon, module A's generated CountryDto.java contains module B's CountryDTO class with fields code, name.
The issue reproduces almost every time with a warm daemon but never on the first build after daemon restart, and never with mvnd clean test-compile (only mvnd clean compile — the extra time from test compilation likely allows internal caches to expire).
Expected behaviour
Each OpenAPIParser.readLocation() call should be fully independent, with no shared mutable state leaking between invocations in the same JVM.
Version matrix
swagger-parser
Result with warm mvnd
2.1.23
✅ Works (last good)
2.1.24
❌ Breaks (first bad)
2.1.25–2.1.37
❌ Breaks
This is NOT the same issue as swagger-core#4672 (Json.mapper() thread-safety, fixed in swagger-core 2.2.24). Both working and broken swagger-parser versions use swagger-core ≥2.2.24 with that fix included.
Why mvnd specifically
Unlike standard Maven, mvnd keeps a long-lived daemon JVM alive between builds. Any static or class-level mutable state in swagger-parser persists across build invocations. Standard Maven (mvn) gets a fresh JVM each time, so the issue does not reproduce there.
Description
Since swagger-parser 2.1.24, schemas from one
OpenAPIParser.readLocation()call can contaminate a subsequent call in the same JVM. This causes cross-module schema contamination when usingopenapi-generator-maven-pluginwith mvnd (Maven Daemon) and parallel builds (-T1C).The issue was introduced by two changes in 2.1.24:
ResolverFullyresponse resolution logic (Add logic to process responses with resolvFully parsing option #2131)IdsTraverserfor OAS 3.1$iddereferencingObserved behaviour
Two independent Maven modules define schemas with case-near-colliding names:
CountryDto(fields:identifier,label)CountryDTO(fields:code,name)After several builds with a warm mvnd daemon, module A's generated
CountryDto.javacontains module B'sCountryDTOclass with fieldscode,name.The issue reproduces almost every time with a warm daemon but never on the first build after daemon restart, and never with
mvnd clean test-compile(onlymvnd clean compile— the extra time from test compilation likely allows internal caches to expire).Expected behaviour
Each
OpenAPIParser.readLocation()call should be fully independent, with no shared mutable state leaking between invocations in the same JVM.Version matrix
This is NOT the same issue as swagger-core#4672 (
Json.mapper()thread-safety, fixed in swagger-core 2.2.24). Both working and broken swagger-parser versions use swagger-core ≥2.2.24 with that fix included.Why mvnd specifically
Unlike standard Maven, mvnd keeps a long-lived daemon JVM alive between builds. Any static or class-level mutable state in swagger-parser persists across build invocations. Standard Maven (
mvn) gets a fresh JVM each time, so the issue does not reproduce there.Environment
-T1C(parallel builds, 1 thread per core)Workaround
Pin swagger-parser to 2.1.23:
Related
Json.mapper()thread-safety (different issue, already fixed)ResolverFullyresponse resolution