Gaffer icon indicating copy to clipboard operation
Gaffer copied to clipboard

Investigate adding an option to disable the ExamplesFactory

Open GCHQDeveloper314 opened this issue 1 year ago • 0 comments

Describe the new feature you'd like An option to disable the REST ExamplesFactory, disabling the ability for a REST endpoint to generate example JSON.

Why do you want this feature? When Gaffer starts, the code run by DefaultExamplesFactory (in practice AbstractExamplesFactory.java) might not be desirable. It's been reported that a lot of output can be logged in some situations. Problems with these factories can also cause an endpoint to crash on startup.

Adding a configuration option to disable would avoid these potential issues.

Additional context For both Jersey and Spring REST, the DefaultExamplesFactory is used to provide example JSON. For Jersey this is used in the Swagger UI and the /graph/operations/details and /graph/operations/details/all endpoints. For Spring it's used only with the endpoints.

For Spring REST, the DefaultExamplesFactory is created in FactoryConfig.java. This is a point where new logic could use a dummy factory which produced only empty JSON to in effect disable this capability without requiring many other changes.

GCHQDeveloper314 avatar Feb 15 '24 14:02 GCHQDeveloper314