Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Extend project lint result struct with includes #2070

Closed

Conversation

TheCodear
Copy link
Contributor

The Gitlab API exposes a list of (recursive) includes when linting a projects ci configuration. The ProjectLintResult struct representing the API response does not reflect this list, so a user of the SDK cannot use this information from the API. It is also not possible to grab this information via response body parsing outside of the go-gitlab client, as the body is already closed when the client code can access it.

So, in short, this change allows the client code to access the list of includes returned by the Gitlab API.

My only concern is the documentation of the includes type. It is not documented in the api docs of the lint API (see https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-cicd-configuration). Instead, one can find the specification in the openapi spec, see https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/openapi/openapi_v2.yaml?plain=1#L52442. But relying on this spec is inconsistent with the rest of the go-gitlab library...

Please let me know if this still is an acceptable change - and of course whether there is anything else missing (e.g. if further tests are required).

Thank you!

@RicePatrick
Copy link
Contributor

@timofurrer -what're your thoughts about "undocumented" features that are only in the OpenAPI spec? I believe that OpenAPI spec is auto-generated, so it may include fields that aren't technically meant for "public" use, but it seems to me as long as it's present there it seems reasonable to support it.

I suppose we could open a documentation update MR and see what comes from that too; if it's denied to include in the docs, I don't think we should support it here.

@timofurrer
Copy link
Contributor

@RicePatrick

I suppose we could open a documentation update MR and see what comes from that too; if it's denied to include in the docs, I don't think we should support it here.

Yes, probably this or an issue. There have been other instances where we asked for doc changes or made the updates. But also, where we've just supported them here. I very much prefer the former though.

@TheCodear
Copy link
Contributor Author

Hey @RicePatrick and @timofurrer thanks for joining in!

There is a similar thing with the jobs field, there is an include_jobs attribute documented in the request (see https://docs.gitlab.com/ee/api/lint.html#validate-a-projects-cicd-configuration) but the response in case this attribute is set to true is omitted - so it might be that the documentation (resp. the examples) is just not up to date to the latest api changes..

I have started an issue on Gitlab on this: https://gitlab.com/gitlab-org/gitlab/-/issues/508011

Although I'm not sure if the issue is placed correctly - I'll maybe route this also via our Gitlab Support...

@timofurrer
Copy link
Contributor

@TheCodear thanks for creating the upstream issue - I've triaged it. Let's see.

@TheCodear
Copy link
Contributor Author

Perfect! thanks @timofurrer

The Gitlab API exposes a list of (recursive) includes when linting
a projects ci configuration. The ProjectLintResult struct representing
the API response does not reflect this list, so a user of the SDK
cannot use this information from the API.
@TheCodear TheCodear force-pushed the feat/extend-project-lint-result branch from 9170949 to afed20c Compare December 6, 2024 15:44
@timofurrer
Copy link
Contributor

@TheCodear we've migrated the repository over to GitLab.com.

Please see #2060 (comment) for more context.

@timofurrer timofurrer closed this Dec 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants