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

Removing field from generatedFields after it was added #171

Closed
IanCaio opened this issue Jan 15, 2018 · 5 comments
Closed

Removing field from generatedFields after it was added #171

IanCaio opened this issue Jan 15, 2018 · 5 comments

Comments

@IanCaio
Copy link

IanCaio commented Jan 15, 2018

I'm currently having some issues trying to remove an generatedField from being included in the data files. At first I had a staticman.yml file that had this parameter:

generatedFields:
  id: "{@id}"

I hadn't noticed at that point that the ID was already included in the properties of the data file as _id and that the ID placeholder didn't work there. So later I removed generatedFields completely. But to my surprise the app kept including the now irrelevant id field, as a string containing {@id}. First I thought the configuration could have been cached and it was a matter of time until staticman read the new file. But it's been a while and it persists, even after I set the parameter to its default value:

  generatedFields:
    date:
      type: date
      options:
      format: "iso8601"

It now includes both the date and the {@id}. I even tried to remove staticmanapp as a collaborator and add it again, but no success.

Is there a way to remove a generatedField from the apps list after it was added?

Thanks in advance!

@IanCaio
Copy link
Author

IanCaio commented Jan 17, 2018

On the repo I had issues, the id field is now gone, but now I have a timestamp that didn't used to be there (both changes without altering the staticman.yml file at all).

I tried to replicate the issue in a brand new repository and the behavior so far was the same:

First I created the Github Page with the staticman.yml requesting the id generated field. I posted to the API (the first PR on the repository). Then I updated the staticman.yml file removing the generated field and posted 2 more times. Both PR's still show the id generated field.

I'm not sure if maybe that's a cache issue. Any ideas what might be the cause of this delay? And about the timestamp field, did it start being included in the last couple of days?

You can see the test repository here:
https://github.com/IanCaio/staticmanapptest

@IanCaio
Copy link
Author

IanCaio commented Jan 17, 2018

Just another update:
After the last comment, the id field was gone, but another unrequested field showed up (commentDate having the date in the ISO format), timestamp wen't missing and date now shows the timestamp instead of the ISO format date. I didn't change the staticman.yml file (except from removing the id generated field before the last comment). It looks like this:

test:
  allowedFields: ["name", "age"]
  branch: "master"
  filename: "{@id}"
  format: "json"
  moderation: true
  path: "_data/test"
  requiredFields: ["name", "age"]

@JokerQyou
Copy link

I think your last issue has something to do with #176

@IanCaio
Copy link
Author

IanCaio commented Mar 12, 2018

It's possible, I'm not sure if @eduardoboucas found any leads on what was causing the issue #176 . Apparently things are working fine at the moment, I did some tests and the only extra fields showing up are date and timestamp. They were not requested in the staticman.yml, but at least the other extra fields (i.e.: layout) stopped being added.

@eduardoboucas
Copy link
Owner

I'm closing this as it seems to be a duplicate of #176, which has been updated. Please re-open this if it's still a problem. Thanks!

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

No branches or pull requests

3 participants