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

io.vertx.openapi.contract.OpenAPIObject Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR5
Show newest version
/*
 * Copyright (c) 2023, SAP SE
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
 * which is available at https://www.apache.org/licenses/LICENSE-2.0.
 *
 * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
 *
 */

package io.vertx.openapi.contract;

import io.vertx.core.json.JsonObject;
import io.vertx.json.schema.internal.JsonObjectProxy;

import java.util.Map;
import java.util.stream.Collectors;

import static java.util.function.Function.identity;

public interface OpenAPIObject {

  /**
   * Returns the part of the related OpenAPI specification which is represented by the OpenAPI object that is
   * implementing this interface.
   * 

* Warning: *
    *
  • In case the contract contains circular references, the returned object is may of type * {@link JsonObjectProxy}, which has some limitations when it comes to copying or serializing.
  • *
  • Due to these limitations, the reference of the original object is returned. Because of this be very * careful when modifying the returned object.
  • *
* * @return a {@link JsonObject} that represents this part of the related OpenAPI specification. */ JsonObject getOpenAPIModel(); /** * Returns the * Specification Extensions of this OpenAPIObject. *

* According to the specification, the extension can be of any type. * * @return the extensions or an empty map if there are none. */ default Map getExtensions() { return getOpenAPIModel().fieldNames().stream().filter(fieldName -> fieldName.startsWith("x-")) .collect(Collectors.toMap(identity(), getOpenAPIModel()::getValue)); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy