Skip to content
This repository was archived by the owner on Mar 17, 2022. It is now read-only.

Refactor and update #6

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

Conversation

briankinney
Copy link

A few small changes:

  • I moved a minor schema conversion task from fetchSchema to convertSchema. This makes it so users don't have to use the exact scraper written here to download the Airtable Schema
  • My Airtable schema does not record foreign tables by column.foreignTable.name. Instead it is necessary to lookup the table name using the table identifier available at column.typeOptions.foreignTableid. If column.foreignTable.name exists in the schema we will still use this value.
  • Added airtable-graphql start command to even further simplify starting the adapter

- Move some schema conversion from fetchSchema to convertSchema
- Use column.typeOptions.foreignTableId to lookup table name
- Add start command to cli for even easier server launch
@briankinney
Copy link
Author

After working on this a bit more and trying to get my own program to download the Airtable schema object I discovered the reason for the way the code is written: the scripts on the Airtable documentation page augment the original serializable schema object by doing things like linking foreign tables directly to the foreign key fields. I was trying to get the tool to work with the schema I had copy/pasted from the page source partly because I haven't set up email/password login for my Airtable account. I don't immediately see a good way to get the code to work both ways.

@thomascullen
Copy link
Owner

Hey! Thanks for the contributions. I haven't had time to work on this project in a while so the way I can't remember a lot of the details of the project. Yeah, the way the Airtable schema object is on their documentation pages is a little strange. Is this PR still a work in progress then or do you have a working solution for what you need? I am going to be revisiting this project in a bit more detail soon enough.

@briankinney
Copy link
Author

briankinney commented May 11, 2019

Sorry, still a work in progress since the code in my branch only works when you copy/paste the schema out of the page source instead of using the scraper. I'm trying to get code working that will extract as much of the schema as possible. At the moment it seems that if I simply delete all objects under key foreignKey foreignTable it removes the cycles and allows for serialization. I'll update soon.

@briankinney
Copy link
Author

Scraper will now only modify the application object by removing all values under key foreignTable. I believe this is the minimum modification required to make the object serializable. I haven't been able to test the scraper directly because my environment is janky but I have used the same code to prepare the application object for serialization in a plugin that performs roughly the same function: https://github.com/briankinney/airtable-swagger/ (the published version of this plugin is behind master branch). The string produced by that plugin is compatible with the rest of the airtable-graphql code. Sorry for not being able to test more thoroughly.

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.

2 participants