Skip to content
This repository has been archived by the owner on Aug 23, 2021. It is now read-only.

bug: Can not save .json files with with unstable_defineSchema #347

Closed
1 task done
logan-anderson opened this issue Jul 14, 2021 · 5 comments · Fixed by #348
Closed
1 task done

bug: Can not save .json files with with unstable_defineSchema #347

logan-anderson opened this issue Jul 14, 2021 · 5 comments · Fixed by #348
Labels
bug Something isn't working pitch:primitiveTypes Issues related to the proposed branching pitch (#15)

Comments

@logan-anderson
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using unstable_defineSchema and --experimental flag in the CLI I am unable to save json documents.

Expected Behavior

Should be able to save document

Steps To Reproduce

  1. In experimental starter in the mono repo add this to the schema.ts collections (may also have to update tinacms dep to 0.43.0)
{
      label: 'test',
      name: 'test',
      path: 'content/test',
      format: 'json',
      fields: [
        {
          label: 'test',
          name: 'test',
          type: 'string',
        },
      ],
    },

Add a test.json with some dummy data
and add this query to your pages/index.tsx file

getTestDocument(relativePath: "test.json") {
      data {
        test
      }
    }

Edit some data and when you click save you get the following error in the network request

{"errors":[{"message":"Expected to find field by name 0","locations":[{"line":3,"column":3}],"path":["updateTestDocument"]}],"data":null}

Environment

- Browser:
- OS: 
- Node: 
- npm:

Your Schema

na

Your GraphQL Query

na

Anything else?

No response

@logan-anderson logan-anderson added bug Something isn't working pitch:primitiveTypes Issues related to the proposed branching pitch (#15) labels Jul 14, 2021
@jeffsee55
Copy link
Member

What was the result of the test.json file? Does it have data in it?

@jeffsee55
Copy link
Member

Just reopening this because I'm not 100% it's fixed. I ran into a separate error message when I tried working with JSON

@logan-anderson
Copy link
Contributor Author

I tried both with and without data. Same error message.

@jeffsee55
Copy link
Member

Ah got it reproduced. This is a bug when the collection name is the same as the field name, so I think it'd happen with markdown too

@logan-anderson
Copy link
Contributor Author

@jeffsee55 is this fixed now?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working pitch:primitiveTypes Issues related to the proposed branching pitch (#15)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants