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

Update the composites guide #37

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update the composites guide #37

wants to merge 1 commit into from

Conversation

JustinaPetr
Copy link
Contributor

Linear Issue

The problem:

Our composites guide has been missing a few steps (e.g. how to compile the composite and produce the .js runtime definition that is used in JavaScript configuration example).

On top of that, the file names haven't been consistent with the names used in other guides as well as CLI vs JavaScript examples on the page.

Proposed solution

  • Added the missing steps for compiling the composite
  • Updated the file names so that they are consistent throughout the guide and are compatible with examples inlcluded in JavaScript Clinet config page.


// Replace by the path to the encoded composite file
await writeEncodedComposite(composite, './my-composite.json')
await writeEncodedComposite(composite, './__generated__/definition.json')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling this json file definition might cause confusion with the definition file resulting after running writeEncodedCompositeRuntime, I think it would be a good idea to leave it as my-composite.json

@@ -33,7 +33,7 @@ Let’s say you have a model written in a `my-schema.graphql` file. To convert t
<TabItem value="cli">

```bash
composedb composite:create my-schema.graphql --output=my-composite.json --did-private-key=your-private-key
composedb composite:create my-schema.graphql --output=./__generated__/definition.json --did-private-key=your-private-key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command does return a simple json file instead of a file inside the __generated__ subdirectory, I mean it will create the output where the users specifies, but then they might confuse this with the definition json file used in the runtime when using the composedb server that is autogenerated by the writeEncodedCompositeRuntime function

```

</TabItem>
</Tabs>

This will create a file called `my-composite.json` which contains the composite in JSON.
This will create a file called `definition.json` which contains the composite definition in JSON.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was correct as it was before.

@PaulLeCam
Copy link
Contributor

I think there's some confusion here between the encoded composite definition, which is a JSON file representing the composite that can be shared by developers to make their composite reusable by other developers, and the runtime definition which is needed by the ComposeDB runtime package to generate the GraphQL schema.
The encoded definition can be used to deploy composites and compile them to the runtime definition but it can't be used directly at runtime.

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.

3 participants