Skip to content

Commit

Permalink
cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Apr 16, 2024
1 parent 5c62300 commit 8ed2326
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 20 deletions.
25 changes: 13 additions & 12 deletions apispec-model/src/main/scala/sttp/apispec/Schema.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ case class Schema(
$comment: Option[String] = None,
$defs: Option[ListMap[String, SchemaLike]] = None,

// Annotations
// https://json-schema.org/draft/2020-12/json-schema-validation#section-9
title: Option[String] = None,
description: Option[String] = None,
default: Option[ExampleValue] = None,
deprecated: Option[Boolean] = None,
readOnly: Option[Boolean] = None,
writeOnly: Option[Boolean] = None,
examples: Option[List[ExampleValue]] = None,

// General assertions
// https://json-schema.org/draft/2020-12/json-schema-validation#section-6.1
`type`: Option[List[SchemaType]] = None,
`enum`: Option[List[ExampleValue]] = None,
const: Option[ExampleValue] = None,

// https://json-schema.org/draft/2020-12/json-schema-validation#section-7
format: Option[String] = None,

// Logical applicators
// https://json-schema.org/draft/2020-12/json-schema-core#section-10.2.1
allOf: List[SchemaLike] = List.empty,
Expand Down Expand Up @@ -107,18 +120,6 @@ case class Schema(
// https://json-schema.org/draft/2020-12/json-schema-core#section-11.3
unevaluatedProperties: Option[SchemaLike] = None,

// https://json-schema.org/draft/2020-12/json-schema-validation#section-7
format: Option[String] = None,

// Annotations
// https://json-schema.org/draft/2020-12/json-schema-validation#section-9
title: Option[String] = None,
description: Option[String] = None,
default: Option[ExampleValue] = None,
deprecated: Option[Boolean] = None,
readOnly: Option[Boolean] = None,
writeOnly: Option[Boolean] = None,
examples: Option[List[ExampleValue]] = None,
// OpenAPI specific
// https://spec.openapis.org/oas/v3.1.0#fixed-fields-19
externalDocs: Option[ExternalDocumentation] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,17 @@ trait JsonSchemaCirceEncoders {
"$ref" := s.$ref,
"$dynamicRef" := s.$dynamicRef,
"$comment" := s.$comment,
"$defs" := s.$defs
"$defs" := s.$defs,
"title" := s.title,
"description" := s.description,
"default" := s.default,
"deprecated" := s.deprecated,
"readOnly" := s.readOnly,
"writeOnly" := s.writeOnly
) ++ typeAndNullable ++ Vector(
"enum" := s.`enum`,
"const" := s.const,
"format" := s.format,
"allOf" := wrappedNullableRef30.map(List(_)).getOrElse(s.allOf),
"anyOf" := (if (wrappedNullableRef30.isDefined) Nil else s.anyOf),
"oneOf" := s.oneOf,
Expand Down Expand Up @@ -103,13 +110,6 @@ trait JsonSchemaCirceEncoders {
"additionalProperties" := s.additionalProperties,
"propertyNames" := s.propertyNames,
"unevaluatedProperties" := s.unevaluatedProperties,
"format" := s.format,
"title" := s.title,
"description" := s.description,
"default" := s.default,
"deprecated" := s.deprecated,
"readOnly" := s.readOnly,
"writeOnly" := s.writeOnly
) ++ exampleFields ++ Vector(
"externalDocs" := s.externalDocs,
"extensions" := s.extensions
Expand Down

0 comments on commit 8ed2326

Please sign in to comment.