test_class.file: http-service/src/test/java/net/runelite/http/service/config/ConfigServiceTest.java
test_class.identifier: ConfigServiceTest
test_case.body: @Test
  	public void testValidateJson()
  	{
  		assertTrue(ConfigService.validateJson("1"));
  		assertTrue(ConfigService.validateJson("3.14"));
  		assertTrue(ConfigService.validateJson("test"));
  		assertTrue(ConfigService.validateJson("\"test\""));
  		assertTrue(ConfigService.validateJson("key:value"));
  		assertTrue(ConfigService.validateJson("{\"key\": \"value\"}"));
  	}
test_case.class_method_signature: ConfigServiceTest.testValidateJson()
test_case.full_signature: @Test public void testValidateJson()
test_case.identifier: testValidateJson
test_case.invocations: assertTrue validateJson assertTrue validateJson assertTrue validateJson assertTrue validateJson assertTrue validateJson assertTrue validateJson
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateJson()
focal_class.declarator: MAX_DEPTH = 8
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_DEPTH = 8;
focal_class.type: int
focal_class.var_name: MAX_DEPTH
focal_class.declarator: MAX_VALUE_LENGTH = 262144
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_VALUE_LENGTH = 262144;
focal_class.type: int
focal_class.var_name: MAX_VALUE_LENGTH
focal_class.declarator: GSON = RuneLiteAPI.GSON
focal_class.modifier: private final
focal_class.original_string: private final Gson GSON = RuneLiteAPI.GSON;
focal_class.type: Gson
focal_class.var_name: GSON
focal_class.declarator: upsertUpdateOptions = new UpdateOptions().upsert(true)
focal_class.modifier: private final
focal_class.original_string: private final UpdateOptions upsertUpdateOptions = new UpdateOptions().upsert(true);
focal_class.type: UpdateOptions
focal_class.var_name: upsertUpdateOptions
focal_class.declarator: mongoCollection
focal_class.modifier: private final
focal_class.original_string: private final MongoCollection<Document> mongoCollection;
focal_class.type: MongoCollection<Document>
focal_class.var_name: mongoCollection
focal_class.file: http-service/src/main/java/net/runelite/http/service/config/ConfigService.java
focal_class.identifier: ConfigService
focal_class.class_method_signature: ConfigService.ConfigService(
  		MongoClient mongoClient,
  		@Value("${mongo.database}") String databaseName
  	)
focal_class.full_signature: @Autowired public  ConfigService(
  		MongoClient mongoClient,
  		@Value("${mongo.database}") String databaseName
  	)
focal_class.identifier: ConfigService
focal_class.modifiers: @Autowired public
focal_class.parameters: (
  		MongoClient mongoClient,
  		@Value("${mongo.database}") String databaseName
  	)
focal_class.signature:  ConfigService(
  		MongoClient mongoClient,
  		@Value("${mongo.database}") String databaseName
  	)
focal_class.class_method_signature: ConfigService.getConfig(int userId)
focal_class.full_signature: private Document getConfig(int userId)
focal_class.identifier: getConfig
focal_class.modifiers: private
focal_class.parameters: (int userId)
focal_class.return: Document
focal_class.signature: Document getConfig(int userId)
focal_class.class_method_signature: ConfigService.get(int userId)
focal_class.full_signature: public Configuration get(int userId)
focal_class.identifier: get
focal_class.modifiers: public
focal_class.parameters: (int userId)
focal_class.return: Configuration
focal_class.signature: Configuration get(int userId)
focal_class.class_method_signature: ConfigService.setKey(
  		int userId,
  		String key,
  		@Nullable String value
  	)
focal_class.full_signature: public boolean setKey(
  		int userId,
  		String key,
  		@Nullable String value
  	)
focal_class.identifier: setKey
focal_class.modifiers: public
focal_class.parameters: (
  		int userId,
  		String key,
  		@Nullable String value
  	)
focal_class.return: boolean
focal_class.signature: boolean setKey(
  		int userId,
  		String key,
  		@Nullable String value
  	)
focal_class.class_method_signature: ConfigService.unsetKey(
  		int userId,
  		String key
  	)
focal_class.full_signature: public boolean unsetKey(
  		int userId,
  		String key
  	)
focal_class.identifier: unsetKey
focal_class.modifiers: public
focal_class.parameters: (
  		int userId,
  		String key
  	)
focal_class.return: boolean
focal_class.signature: boolean unsetKey(
  		int userId,
  		String key
  	)
focal_class.class_method_signature: ConfigService.parseJsonString(String value)
focal_class.full_signature: @VisibleForTesting static Object parseJsonString(String value)
focal_class.identifier: parseJsonString
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (String value)
focal_class.return: Object
focal_class.signature: Object parseJsonString(String value)
focal_class.class_method_signature: ConfigService.validateJson(String value)
focal_class.full_signature: @VisibleForTesting static boolean validateJson(String value)
focal_class.identifier: validateJson
focal_class.modifiers: @VisibleForTesting static
focal_class.parameters: (String value)
focal_class.return: boolean
focal_class.signature: boolean validateJson(String value)
focal_class.class_method_signature: ConfigService.validateObject(JsonElement jsonElement, int depth)
focal_class.full_signature: private static boolean validateObject(JsonElement jsonElement, int depth)
focal_class.identifier: validateObject
focal_class.modifiers: private static
focal_class.parameters: (JsonElement jsonElement, int depth)
focal_class.return: boolean
focal_class.signature: boolean validateObject(JsonElement jsonElement, int depth)
focal_method.body: @VisibleForTesting
  	static boolean validateJson(String value)
  	{
  		try
  		{
  			// I couldn't figure out a better way to do this than a second json parse
  			JsonElement jsonElement = RuneLiteAPI.GSON.fromJson(value, JsonElement.class);
  			return validateObject(jsonElement, 1);
  		}
  		catch (JsonSyntaxException ex)
  		{
  			// the client submits the string representation of objects which is not always valid json,
  			// eg. a value with a ':' in it. We just ignore it now. We can't json encode the values client
  			// side due to them already being strings, which prevents gson from being able to convert them
  			// to ints/floats/maps etc.
  			return value.length() < MAX_VALUE_LENGTH;
  		}
  	}
focal_method.class_method_signature: ConfigService.validateJson(String value)
focal_method.full_signature: @VisibleForTesting static boolean validateJson(String value)
focal_method.identifier: validateJson
focal_method.invocations: fromJson validateObject length
focal_method.modifiers: @VisibleForTesting static
focal_method.parameters: (String value)
focal_method.return: boolean
focal_method.signature: boolean validateJson(String value)