Skip to content

Commit

Permalink
filter deprecated properties in TS generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Aug 9, 2023
1 parent aa5c0b0 commit 763bae5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ fun AnyType.deprecated() : Boolean {

fun Property.deprecated() : Boolean {
val anno = this.getAnnotation("deprecated")
return (anno != null && (anno.value as BooleanInstance).value)
if (anno != null) {
return (anno.value as BooleanInstance).value
}
val typeAnno = this.type.getAnnotation("deprecated")
return (typeAnno != null && (typeAnno.value as BooleanInstance).value)
}

fun ResourceContainer.allMethods(): List<Method> = this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TypeScriptModuleRenderer constructor(override val vrapTypeProvider: VrapTy
val renderProperties = if (all) allProperties else properties
return renderProperties
.filter { !it.isPatternProperty() && it.name != discriminator() }
.filter { !it.deprecated() }
.filterNot { it.deprecated() }
.map {
val comments = it.type.toTsCommentList().plus(it.markDeprecated())
val comment = if (comments.isEmpty()) "" else comments.joinToString("\n*\t", "/**\n*\t", "\n*/").escapeAll()
Expand Down

0 comments on commit 763bae5

Please sign in to comment.