这是indexloc提供的服务,不要输入任何密码
Skip to content

JsonUtil improvement #37

@propertius

Description

@propertius

Hi @Lambdua, I'm using your library specially for the Assistants API. Since yesterday the added a parallel_tool_calls param, I am getting this error:

Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "parallel_tool_calls" (class com.theokanning.openai.assistants.run.Run), not marked as ignorable...

What I did locally as a workaround was to make the JsonUtil internal Mapper a bit more robust, so that unknown properties would not make the parsing fail:

private static class ObjectMapperHolder {
		private static final ObjectMapper MAPPER = new ObjectMapper();
		static {
			MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
			MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
			MAPPER.setPropertyNamingStrategy(PropertyNamingStrategies.LOWER_CAMEL_CASE);
		}
	}

What do you think of this change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions