-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generator: HACK for new case of swagger-parser#1961
With the 2024.1 models, swagger-parser is now creating additional duplicated schemas in the graph, suffixed with "_1". This is the same behavior that was observed in swagger-api/swagger-parser#1961, only this time it's appearing even with my changes to v2.1.17. Since I'm committed at this point to a Rust rewrite, implement a hack to allow model generation to succeed.
- Loading branch information
1 parent
011f083
commit 87cf956
Showing
2 changed files
with
35 additions
and
6 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
19 changes: 19 additions & 0 deletions
19
...sh-generator/src/main/java/com/twardyece/dmtf/model/mapper/BlacklistModelModelMapper.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,19 @@ | ||
package com.twardyece.dmtf.model.mapper; | ||
|
||
import java.util.HashMap; | ||
import java.util.Optional; | ||
|
||
public class BlacklistModelModelMapper implements IModelModelMapper { | ||
HashMap<String, String> blacklist; | ||
public BlacklistModelModelMapper(HashMap<String, String> blacklist) { | ||
this.blacklist = blacklist; | ||
} | ||
@Override | ||
public Optional<String> match(String model) { | ||
if (this.blacklist.containsKey(model)) { | ||
return Optional.of(this.blacklist.get(model)); | ||
} else { | ||
return Optional.empty(); | ||
} | ||
} | ||
} |