Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project's pushRules missing commit_committer_name_check settings with Gitlab v17.3.3-ee #1171

Closed
bedla opened this issue Sep 24, 2024 · 1 comment · Fixed by #1183
Closed

Comments

@bedla
Copy link

bedla commented Sep 24, 2024

Hi,

I found that when getting push rules for project, there is commit_committer_name_check property from response missing in target DTO.
Could you take a look at it?

Also I was wondering that it might improved to map unknown properties to Map<String, Object>, like I can do with Jackcon Databind - please take a look below.

Thank you

Ivos


DTO with mapping:

class SomeDtoV2 {
    private String stringValue;
    private Integer integerValue;
    @JsonAnyGetter
    @JsonAnySetter
    private Map<String, Object> dynamicValues = new LinkedHashMap<>();
    // ...
}

Exec:

SomeDtoV2 dto = new ObjectMapper()
    .readValue("{\"stringValue\": \"bar\", \"integerValue\": 456, \"xxx\": 999, \"yyy\": \"hello\"}", SomeDtoV2.class);
System.out.println(dto);

Console:

SomeDtoV2{stringValue='bar', integerValue=456, dynamicValues={xxx=999, yyy=hello}}
@bedla
Copy link
Author

bedla commented Sep 24, 2024

Workaround

class MyProjectApi(gitLabApi: GitLabApi) : ProjectApi(gitLabApi) {
    override fun getPushRules(projectIdOrPath: Any?): MyPushRules? {
        val response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "push_rule")
        return (response.readEntity(MyPushRules::class.java))
    }
}

class MyPushRules(
) : PushRules() {
    var commitCommitterNameCheck: Boolean? = null

    override fun toString(): String {
        return JacksonJson.toJsonString(this)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant