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

Fix import of issues without body message #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ssinhaleite
Copy link

The CSV import threw an error when an issue didn't have a body defined. Since it is a good practice to have a body defined, in the case of importing issues, we duplicate the title into the body. While this doesn't clarify the issue, it highlights the problem and still imports the issue.

Another option would be to remove the verification that the body is empty whatsoever, and if a body column exists, just add it the way it is, even if empty.

The CSV import threw an error when an issue didn't have a body defined.
Since it is a good practice to have a body defined, in the case of importing issues, we duplicate the title into the body. While this doesn't clarify the issue, it highlights the problem and still imports the issue.
@gavinr
Copy link
Owner

gavinr commented Dec 5, 2023

Hi @ssinhaleite, thanks for the PR.

The CSV import threw an error when an issue didn't have a body defined

Can you tell me more about the error that you received? Was it from this library or from the GitHub API? Can you provide an example CSV that causes the error to happen?

Thanks!

@ssinhaleite
Copy link
Author

Hi @gavinr! I've just added a CSV example file that would raise an error.

It generates the following error message:

Error
RequestError [HttpError]: Validation Failed: {"resource":"Issue","code":"missing_field","field":"body"}
    at /home/vleite/.nvm/versions/node/v20.10.0/lib/node_modules/github-csv-tools/node_modules/@octokit/request/dist-node/index.js:122:21
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  
  ...

@gavinr
Copy link
Owner

gavinr commented Dec 5, 2023

Thanks for providing the example.

As a user, if I'm trying to import your example:
image

I would NOT expect the issue title to be in the body of the first issue... I would actually expect the body to be empty.

In the GitHub web UI, you CAN create an issue with an empty body.

So I think we need to do some research to figure out how to create an issue with an empty body in these cases.

If you'd like to update your PR to do that, please do. Otherwise we could close this and open an issue for discussion.

@ssinhaleite
Copy link
Author

Hi @gavinr,

Yes, indeed it is possible to create an issue without body content in the web interface, and replicating the title in the body of an issue is not the ideal case.

However, although the REST API (https://docs.github.com/en/rest/issues/issues?apiVersion=2022-11-28#create-an-issue) says the title is the only required field, I had tried to create an issue with the title and without a body, and I keep getting the error: 422 - "missing field: body". This error contains the same structure as if I try to create an issue with a body and no title, which indicates the body is being considered a required field. The error doesn't appear if I remove any other field.

I understand if this is not a solution for you. I forked the project and added this solution to my fork of your code.
At least I could import all my issues.

Thank you for your consideration.

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 this pull request may close these issues.

2 participants