All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.emm035.openapi.immutables.v3.schemas.AbstractArraySchema Maven / Gradle / Ivy

package io.github.emm035.openapi.immutables.v3.schemas;

import io.github.emm035.openapi.immutables.v3.references.Referenceable;
import io.github.emm035.openapi.immutables.v3.shared.OpenApiStyle;
import org.immutables.value.Value.Check;
import org.immutables.value.Value.Immutable;
import org.immutables.value.Value.Parameter;

import java.util.Optional;

import static org.immutables.value.Value.Default;


@OpenApiStyle
@Immutable
public abstract class AbstractArraySchema implements TypedSchema {
  @Override
  @Default
  public Type getType() {
    return Type.ARRAY;
  }
  @Parameter
  public abstract Referenceable getItems();

  public abstract Optional getUniqueItems();
  public abstract Optional getMinItems();
  public abstract Optional getMaxItems();

  @Check
  AbstractArraySchema normalizeExtensions() {
    if (Checks.allValid(this)) {
      return this;
    }
    return ArraySchema.builder()
      .from(this)
      .setExtensions(Checks.validExtensions(this))
      .build();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy