相关文章推荐
getAllSecuritySchemeRequestHeaders ()
Gets an alphabetically sorted set of request headers used by every security scheme associated with the API.
java.util.Set<java.lang.String> getAllSecuritySchemeResponseHeaders ()
Gets an alphabetically sorted set of response headers used by every security scheme associated with the API.
OpenApiConfig getConfig ()
Gets the configuration object used for the conversion.
JsonSchemaConverter getJsonSchemaConverter ()
Gets the JSON schema converter.
Model getModel ()
Gets the Smithy model being converted.
OpenApiProtocol < T > getOpenApiProtocol ()
Gets the OpenAPI protocol conversion object.
java.lang.String getPointer ​( ToShapeId shapeId)
Gets the the JSON pointer string to a specific shape.
getProtocolTrait ()
Gets the protocol trait that is being converted.
Schema getSchema ​(java.lang.String pointer)
Gets a converted schema from the context object by JSON pointer and throws if the schema does not exist.
java.util.List< SecuritySchemeConverter <? extends Trait >> getSecuritySchemeConverters ()
Gets the security scheme converters that are compatible with the selected protocol.
ServiceShape getService ()
Gets the service shape being converted.
java.util.Map<java.lang.String,​ Schema > getSynthesizedSchemas ()
Gets all of the synthesized schemas that needed to be created while generating the OpenAPI artifact.
Schema inlineOrReferenceSchema ​( MemberShape member)
Gets the exiting schema of the shape if it's meant to be inlined, otherwise creates a $ref to the shape if it is meant to be reused across the generated schema.
java.lang.String putSynthesizedSchema ​(java.lang.String name, Schema schema)
Puts a new synthesized schema that is needed to convert to OpenAPI.
boolean usesHttpCredentials ()
Reports if any authentication mechanisms in the entire model use HTTP credentials, such as cookies, browser-managed usernames and passwords, or TLS client certificates.

getConfig

public OpenApiConfig getConfig()
Gets the configuration object used for the conversion.

Plugins can query this object for configuration values.

Returns:
Returns the configuration object.

getJsonSchemaConverter

public JsonSchemaConverter getJsonSchemaConverter()
Gets the JSON schema converter.
Returns:
Returns the JSON Schema converter.

getProtocolTrait

public T getProtocolTrait()
Gets the protocol trait that is being converted.
Returns:
Returns the protocol ID.

getOpenApiProtocol

public OpenApiProtocol<T> getOpenApiProtocol()
Gets the OpenAPI protocol conversion object.
Returns:
Returns the OpenAPI protocol.

getSchema

public Schema getSchema​(java.lang.String pointer)
Gets a converted schema from the context object by JSON pointer and throws if the schema does not exist.
Parameters:
pointer - Schema to retrieve by JSON pointer (e.g., "#/components/schemas/foo").
Returns:
Returns the found schema.
Throws:
OpenApiException - if the schema cannot be found.

getPointer

public java.lang.String getPointer​(ToShapeId shapeId)
Gets the the JSON pointer string to a specific shape.
Parameters:
shapeId - Shape ID to convert into a JSON pointer to a schema component.
Returns:
Returns the JSON pointer to this shape as a schema component.

createRef

public Schema createRef​(ToShapeId shapeId)
Creates a schema that contains a $ref that points to a schema component.
Parameters:
shapeId - Shape ID to point to with a $ref schema.
Returns:
Returns the creates schema.

inlineOrReferenceSchema

public Schema inlineOrReferenceSchema​(MemberShape member)
Gets the exiting schema of the shape if it's meant to be inlined, otherwise creates a $ref to the shape if it is meant to be reused across the generated schema.
Parameters:
member - Member to inline or reference.
Returns:
Returns the schema for the member.

getSecuritySchemeConverters

public java.util.List<SecuritySchemeConverter<? extends Trait>> getSecuritySchemeConverters()
Gets the security scheme converters that are compatible with the selected protocol.
Returns:
Returns the security scheme converters.

usesHttpCredentials

public boolean usesHttpCredentials()
Reports if any authentication mechanisms in the entire model use HTTP credentials, such as cookies, browser-managed usernames and passwords, or TLS client certificates.

This is useful when integrating with things like CORS.

Returns:
Whether any authentication mechanism relies on browser-managed credentials.
See Also:
Browser-managed credentials

getAllSecuritySchemeRequestHeaders

public java.util.Set<java.lang.String> getAllSecuritySchemeRequestHeaders()
Gets an alphabetically sorted set of request headers used by every security scheme associated with the API.

This is useful when integrating with things like CORS.

Returns:
Returns the set of every request header used by every security scheme.

getAllSecuritySchemeResponseHeaders

public java.util.Set<java.lang.String> getAllSecuritySchemeResponseHeaders()
Gets an alphabetically sorted set of response headers used by every security scheme associated with the API.

This is useful when integrating with things like CORS.

Returns:
Returns the set of every response header used by every security scheme.

getSynthesizedSchemas

public java.util.Map<java.lang.String,​Schema> getSynthesizedSchemas()
Gets all of the synthesized schemas that needed to be created while generating the OpenAPI artifact.
Returns:
Returns the "synthesized" schemas as an immutable map.

putSynthesizedSchema

public java.lang.String putSynthesizedSchema​(java.lang.String name,
                                             Schema schema)
Puts a new synthesized schema that is needed to convert to OpenAPI.

Synthesized schemas are used when ad-hoc schemas are necessary in order to materialize some change in OpenAPI while still providing an explicit name. For example, when generating many of the RESTful protocols, members from the input of an operation might come together to form the payload of a request. In Smithy, it's fine to use only part of the input to derive the payload, whereas in OpenAPI, you need a schema that's dedicated to the payload.

The primary alternative to synthesized schemas is inlined schema definitions. The problem with inline schemas is that they don't have an explicit or even deterministic name when used with other platforms (for example, API Gateway will generate a random name for an object if one is not given).

This method is thread-safe.

Parameters:
name - Name of the schema to put into components/schemas. Nested pointers are not supported.
schema - The schema to put.
Returns:
Returns a JSON pointer to the created schema.
 
推荐文章