Skip to content

Commit

Permalink
wip: swagger ui
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasKellerer committed Apr 29, 2024
1 parent 1a58e67 commit 82a8e61
Showing 1 changed file with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,33 @@ private fun primitiveSequenceFilterFieldSchemas(sequenceFilterFields: SequenceFi

private fun filterFieldSchema(fieldType: SequenceFilterFieldType) =
when (fieldType) {
SequenceFilterFieldType.String, SequenceFilterFieldType.PangoLineage ->
SequenceFilterFieldType.PangoLineage ->
Schema<String>().anyOf(
listOf(
Schema<String>().type(fieldType.openApiType),
arraySchema(Schema<String>().type(fieldType.openApiType)),
nonNullableStringSchema(fieldType.openApiType),
nonNullableStringArraySchema(fieldType.openApiType),
),
)

else -> Schema<String>().type(fieldType.openApiType)
SequenceFilterFieldType.String ->
Schema<String>().anyOf(
listOf(
nullableStringSchema(fieldType.openApiType),
nullableStringArraySchema(fieldType.openApiType),
),
)

else -> nullableStringSchema(fieldType.openApiType)
}

private fun nullableStringSchema(type: String) = Schema<String>().type(type).nullable(true)

private fun nullableStringArraySchema(type: String) = arraySchema(nullableStringSchema(type))

private fun nonNullableStringSchema(type: String) = Schema<String>().type(type)

private fun nonNullableStringArraySchema(type: String) = arraySchema(nonNullableStringSchema(type))

private fun requestSchemaForCommonSequenceFilters(
requestProperties: Map<SequenceFilterFieldName, Schema<out Any>>,
): Schema<*> =
Expand Down

0 comments on commit 82a8e61

Please sign in to comment.