faf-java-api icon indicating copy to clipboard operation
faf-java-api copied to clipboard

adding fields for #894

Open K-ETFreeman opened this issue 1 year ago • 10 comments

solves #894

K-ETFreeman avatar Oct 12 '24 17:10 K-ETFreeman

Can you add the integration tests to check the permissions for updates works for these fields.

You mean writing another .java file like this? image MatchmakerQueueMapPoolElideTest.java?

K-ETFreeman avatar Nov 24 '24 12:11 K-ETFreeman

Yes

Sheikah45 avatar Nov 24 '24 12:11 Sheikah45

MatchmakerQueueMapPoolElideTest.java

i also should probably write prepMatchmakerQueueMapPoolData.sql then

K-ETFreeman avatar Nov 24 '24 12:11 K-ETFreeman

seeing -- matchmaker_queue is populated by R__070_matchmaker_queue.sql from Flyway comment tho, not sure

K-ETFreeman avatar Nov 24 '24 12:11 K-ETFreeman

Yes

image hm where API gets data about db schema? i was thinking from commons but seems like not

K-ETFreeman avatar Nov 24 '24 14:11 K-ETFreeman

https://github.com/FAForever/faf-java-api/blob/ef26b9c89ef0ee2d41d5168342d1c088a3cae491/src/inttest/java/com/faforever/api/config/MainDbTestContainers.java#L24

Brutus5000 avatar Nov 25 '24 14:11 Brutus5000

And at runtime here https://github.com/FAForever/faf-java-api/blob/ef26b9c89ef0ee2d41d5168342d1c088a3cae491/src/main/resources/config/application.yml#L19

Brutus5000 avatar Nov 25 '24 14:11 Brutus5000

I have no clue why the java commons project doesn't work anymore

Brutus5000 avatar Dec 23 '24 19:12 Brutus5000

I have no clue why the java commons project doesn't work anymore

Hi, I see a pattern here, If you take a look at the recent failing PRs for the faf-java-api (e.g. the dependa-bot ones for bumping up spring boot to 3.4.1 and Elide to 7.1.4), they all fail on this particular unit test - com.faforever.api.deployment.ExeUploaderControllerTest#testBadRequestUploadFileWithWrongExeExtension

The common between them and this PR is that they bring a change to the class path, by transitively adding a higher version of jackson (this PR as well because it points to a newer version (see the build.gradle change) of the faf-java-commons which has jackson = "2.18.1")

The actual issue boils down to, when Jackson tries to serialize the error response JSON produced by the ControllerAdvice/GlobalExceptionHandler -

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Conflicting property-based creators: already had explicit creator [constructor for `com.faforever.api.error.ErrorResult` (5 args), annotations: {interface java.beans.ConstructorProperties=@java.beans.ConstructorProperties({"httpStatusCode", "title", "detail", "appCode", "meta"})}, encountered another: [constructor for `com.faforever.api.error.ErrorResult` (3 args), annotations: {interface java.beans.ConstructorProperties=@java.beans.ConstructorProperties({"httpStatusCode", "title", "detail"})} (through reference chain: com.faforever.api.error.ErrorResponse["errors"]->java.util.ArrayList[0])
	at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
	at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1328)
	at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1475)
	at com.fasterxml.jackson.databind.SerializerProvider.findContentValueSerializer(SerializerProvider.java:811)
	at com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.findAndAddSecondarySerializer(PropertySerializerMap.java:90)
	at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase._findAndAddDynamic(AsArraySerializerBase.java:314)
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:115)
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79)
	at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18)
	at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:732)
	at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:770)
	at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:184)
	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:502)
	at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:341)
	at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1583)
	at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:1061)
	at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:486)
	... 153 common frames omitted

Ivan-Shaml avatar Dec 24 '24 16:12 Ivan-Shaml

Fixed the problematic class, from the exception in my previous comment in this new PR - #918 I recommend to rebase the spring boot 3.4 PR and this one, when #918 gets merged

Ivan-Shaml avatar Dec 25 '24 21:12 Ivan-Shaml