gchq / Gaffer

A large-scale entity and relation database supporting aggregation of properties
Apache License 2.0
1.77k stars 350 forks source link

Investigate adding an option to disable the ExamplesFactory #3161

Open GCHQDeveloper314 opened 7 months ago

GCHQDeveloper314 commented 7 months ago

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.