Package dev.tachyonmcp.api.json.spi
Interface JsonSchemaFactory<T>
- Type Parameters:
T- the source representation type
- All Known Implementing Classes:
Jackson3JsonFactory,JacksonNodeJsonFactory,JacksonObjectJsonFactory
public interface JsonSchemaFactory<T>
Creates a
JsonSchema from a source representation, validating it in the process.
Unlike JsonSchema.of(String), which wraps a string without inspecting it, a
factory implementation parses source and rejects malformed JSON.
Discoverable via ServiceLoader: implementations register themselves in
META-INF/services/dev.tachyonmcp.api.json.spi.JsonSchemaFactory, self-reporting the
source type they accept through sourceType() so JsonSchema.from(Object, Class)
can resolve the right provider for a given type.
- Author:
- Konstantin Pavlov
-
Method Summary
Modifier and TypeMethodDescriptionReturns the source type this factory accepts.toJsonSchema(T source) Creates a schema fromsource.
-
Method Details
-
sourceType
Returns the source type this factory accepts.- Returns:
- the source type
-
toJsonSchema
Creates a schema fromsource.- Parameters:
source- the source representation- Returns:
- the parsed schema
- Throws:
IllegalArgumentException- ifsourceis not valid JSON
-