Package v1.sulphurapi.handlers.openapi
Class SchemaHandler
java.lang.Object
v1.sulphurapi.handlers.openapi.SchemaHandler
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaHandler
(APILoader apiLoader) Constructor for SchemaHandler that initializes the user grid and endpoints panel UI. -
Method Summary
Modifier and TypeMethodDescriptionstatic io.swagger.v3.oas.models.media.Schema
<?> getSchemaFromContent
(io.swagger.v3.oas.models.media.Content content, String mediaType) This method retrieves the schema from the content based on the provided media type.static io.swagger.v3.oas.models.media.Schema
<?> This method retrieves the schema from a reference string.void
This method loads the schema properties from the selected media type in the endpoints panel UI and updates the user grid's combo box with the available properties.void
static void
tableResizeRenderer
(JTable table) This method resizes the columns of a JTable to fit the content.
-
Constructor Details
-
SchemaHandler
Constructor for SchemaHandler that initializes the user grid and endpoints panel UI. It also sets up action listeners for the load endpoint button and send bulk button.- Parameters:
bulkGrid
- the UserGrid instance to be used for displaying parametersendpointsHandler
- the EndpointsPanelUI instance to be used for managing endpoints
-
-
Method Details
-
loadSchemaToUserGrid
public void loadSchemaToUserGrid()This method loads the schema properties from the selected media type in the endpoints panel UI and updates the user grid's combo box with the available properties. -
sendBulkEvent
public void sendBulkEvent() -
tableResizeRenderer
This method resizes the columns of a JTable to fit the content. It iterates through each column, calculates the preferred width based on the header and cell renderers, and sets the preferred width for each column.- Parameters:
table
- the JTable whose columns need to be resized
-
getSchemaFromContent
public static io.swagger.v3.oas.models.media.Schema<?> getSchemaFromContent(io.swagger.v3.oas.models.media.Content content, String mediaType) This method retrieves the schema from the content based on the provided media type. If the media type is not specified, it returns the schema from the first entry in the content.- Parameters:
content
- the Content object containing media types and schemasmediaType
- the media type to look for in the content- Returns:
- the Schema object if found, otherwise null
-
getValueOfSchemaComponent
This method retrieves the schema from a reference string. It checks if the reference is in the format of a component schema and returns the corresponding Schema object.- Parameters:
ref
- the reference string in the format of "#/components/schemas/{componentName}"- Returns:
- the Schema object if found, otherwise null
-