ctreminiom / go-atlassian

✨ Golang Client Library for Atlassian Cloud.
https://docs.go-atlassian.io
MIT License
131 stars 34 forks source link

Custom Fields not optional during issue create? #300

Closed mavjsh closed 3 months ago

mavjsh commented 3 months ago

go-atlassian version main

go-atlassian component

Describe the bug :bug: In the docs it states that custom fields are optional(https://docs.go-atlassian.io/cookbooks/create-jira-issue#step-5-custom-fields-definition). But this(https://github.com/ctreminiom/go-atlassian/blob/0df29d40c19e5c77af91d60a9e72a56145f5c07a/pkg/infra/models/jira_issue_v2.go#L26) returns an error if you pass an empty CustomFields{} struct. The docs don't explain how to do this optionally.

To Reproduce :construction:

payload := &jiramodels.IssueSchemeV2{
        Fields: &jiramodels.IssueFieldsSchemeV2{
            Summary:     summary,
            Project:     &jiramodels.ProjectScheme{ID: "10000"},
            IssueType:   &jiramodels.IssueTypeScheme{Name: "Story"},
            Description: description,
        },
    }

    var customFields = jiramodels.CustomFields{}

    _, _, err := atlassian.Issue.Create(context.Background(), payload, &customFields)
    if err != nil {
        log.Fatal(err)
    }

Expected behavior :white_check_mark: I expect the issue to create. Screenshots :page_facing_up: "no custom-fields set" Additional context

Code snippet

ctreminiom commented 3 months ago

Hi @mavjsh,

Thank you for investing time in this project!.

I just created the PR: https://github.com/ctreminiom/go-atlassian/pull/302 that fixes that error.