Skip to content

Commit

Permalink
fix deprecation of properties for php codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Sep 4, 2023
1 parent f07ecb0 commit 91108a7
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
|public function build(): ${vrapType.simpleClassName}
|{
| return new ${vrapType.simpleClassName}Model(
| <<${this.allProperties.filter { it.getAnnotation("deprecated") == null }.filter { property -> property != discriminator }.filter { !it.isPatternProperty() }.joinToString(",\n") { it.buildProperty() }}>>
| <<${this.allProperties.filterNot { it.deprecated() }.filter { property -> property != discriminator }.filter { !it.isPatternProperty() }.joinToString(",\n") { it.buildProperty() }}>>
| );
|}
""".trimMargin()
Expand All @@ -146,7 +146,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
}

fun ObjectType.imports() = this.getImports(this.allProperties).map { "use ${it.escapeAll()};" }
.plus(this.getImports(this.allProperties.filter { it.getAnnotation("deprecated") == null }.filter { !it.type.isScalar() && !(it.type is ArrayType) && !(it.type.toVrapType().simpleName() == "stdClass") }).map { "use ${it.escapeAll()}Builder;" })
.plus(this.getImports(this.allProperties.filterNot { it.deprecated() }.filter { !it.type.isScalar() && !(it.type is ArrayType) && !(it.type.toVrapType().simpleName() == "stdClass") }).map { "use ${it.escapeAll()}Builder;" })
.distinct()
.sorted()
.joinToString(separator = "\n")
Expand Down Expand Up @@ -193,7 +193,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
val discriminator = this.discriminatorProperty()

return this.allProperties
.filter { it.getAnnotation("deprecated") == null }
.filterNot { it.deprecated() }
.filter { property -> property != discriminator }
.filter { !it.isPatternProperty() }.joinToString(separator = "\n\n") { it.toPhpField() }
}
Expand All @@ -202,7 +202,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
val discriminator = this.discriminatorProperty()

return this.allProperties
.filter { it.getAnnotation("deprecated") == null }
.filterNot { it.deprecated() }
.filter { property -> property != discriminator }
.filter { !it.isPatternProperty() }.joinToString(separator = "\n\n") { it.wither() }
}
Expand All @@ -211,7 +211,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
val discriminator = this.discriminatorProperty()

return this.allProperties
.filter { it.getAnnotation("deprecated") == null }
.filterNot { it.deprecated() }
.filter { property -> property != discriminator }
.filter { !it.isPatternProperty() }
.filter { !it.type.isScalar() && !(it.type is ArrayType) && !(it.type.toVrapType().simpleName() == "stdClass") && !(it.type.toVrapType().simpleName() == "mixed") }.joinToString(separator = "\n\n") { it.withBuilder() }
Expand All @@ -221,7 +221,7 @@ class PhpBuilderObjectTypeRenderer constructor(override val vrapTypeProvider: Vr
val discriminator = this.discriminatorProperty()

return this.allProperties
.filter { it.getAnnotation("deprecated") == null }
.filterNot { it.deprecated() }
.filter { property -> property != discriminator }
.filter { !it.isPatternProperty() }.joinToString(separator = "\n\n") { it.getter() }
}
Expand Down

0 comments on commit 91108a7

Please sign in to comment.