Skip to content

7446 document rest api#7582

Open
ca61688 wants to merge 26 commits into
developfrom
7446-document-rest-api
Open

7446 document rest api#7582
ca61688 wants to merge 26 commits into
developfrom
7446-document-rest-api

Conversation

@ca61688

@ca61688 ca61688 commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Make sure you have checked all steps below.

Issue

  • My PR fully resolves the following issues. I've referenced an issue in the PR title, for example "Issue 1234 - My
    Feature". Note that before an issue is finished, you can still make a pull request by raising a separate issue
    for your progress.

Tests

  • My PR adds the following tests based on our test strategy OR does not need testing for this extremely good reason:
    • Manual testing following documentation added

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it, or I have linked to a
    separate issue for that below.
  • If I have added new Java code, I have added Javadoc that explains it following our conventions and style.
  • If I have added or removed any dependencies from the project, I have updated the NOTICES file.

@ca61688 ca61688 linked an issue Jul 1, 2026 that may be closed by this pull request
@ca61688
ca61688 force-pushed the 7446-document-rest-api branch from ab78686 to 177baef Compare July 3, 2026 10:44
@ca61688
ca61688 marked this pull request as ready for review July 3, 2026 11:59
@ca61688 ca61688 added the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 3, 2026
time
* `DashboardStack` - to create a CloudWatch dashboard showing recorded metrics
* `BulkExportStack` - to export a whole table as parquet files
* `RestApiStack` - for a [REST API](../rest-api/README.md) to interact with the instance over HTTPS. Currently early;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think we need a better word than "early" here
Suggest in develop, or something along those lines

Comment thread docs/development/rest-api.md Outdated
Comment thread docs/development/release-process.md Outdated
Comment thread docs/rest-api/README.md Outdated
Comment thread java/clients/pom.xml Outdated
configBucketStack.grantWrite(grantee);
tableIndexStack.grantReadWrite(grantee);
stateStoreStacks.grantReadWritePartitions(grantee);
stateStoreStacks.grantReadWriteAllFilesAndPartitions(grantee);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why was this changed? I don't think editing the table configuration involves files?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

When I was testing the rest api the add table wasn't working and needed this change

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this needs raising as a separate bug.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why?

@patchwork01 patchwork01 Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If the API isn't working we'll want to include the bug fix in the changelog. If we do it in this PR we're likely to miss it when writing the changelog, and we wouldn't have a record that the bug existed.

We could also do with identifying when the bug first occurred, and how it broke.

It's not clear from this PR what the bug is, or why this would be needed. Do you want to clarify it here or just raise a new issue?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Raised #7677

instanceProperties = requireNonNull(builder.instanceProperties);
addTable = requireNonNull(builder.addTable);
// Fields may be null when this route is instantiated by the OpenAPI doc generator, which only invokes the
// openApi* methods below. handle() will fail with an NPE if the route is dispatched a request without them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is it necessary to instantiate this class in order to generate the documentation? I'm not sure that needs to be the case?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Because the methods for generating the openApi doc are instance methods and need to be so that the Generator can loop through all routes calling them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there another way you could design it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Why?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it feels clunky to support two different modes of instantiation. It feels misleading that some of the fields can be null, when they are required to be non-null for the class to work. It makes the class rather big. The OpenAPI definition isn't actually derived from anything in this class, so I think it doesn't look like it really needs to be all one class?

@patchwork01 patchwork01 removed the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 6, 2026
@ca61688 ca61688 added the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 14, 2026
@ca61688 ca61688 assigned patchwork01 and unassigned patchwork01 and ca61688 Jul 14, 2026
@ca61688

ca61688 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review

@patchwork01 patchwork01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I also commented on the following previous threads:

#7582 (comment)
#7582 (comment)

Comment thread docs/development/release-process.md Outdated
Comment thread docs/deployment/instance-configuration.md Outdated
Comment thread docs/usage/rest-api/add-table.md Outdated
Comment thread docs/usage/rest-api/add-table.md Outdated
Comment thread docs/usage/tables.md Outdated
Comment thread docs/usage/tables.md
`sendToIngestBatcher.sh`.

### Add table
#### Using the REST API

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe it would be best to cover the REST API in a single place? A user will know whether they want to use the API or the scripts, and the documentation will be harder to read if it switches between the two.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's exactly why I initially had the REST API section separated out which you asked me to change

@patchwork01 patchwork01 Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what you mean, I don't see a comment where I asked for that. When it was separate I commented that the way it was structured didn't fit with our existing documentation, I didn't suggest a particular change - #7582 (comment).

I think the problem here is there's a lot going on in this PR/issue, including the OpenAPI definitions and the bug fix, as well as the docs changes.

Here's a link to this thread if you're reading this in the review: #7582 (comment)

Comment thread docs/usage-guide.md Outdated
## REST API

Sleeper has an optional REST API for interacting with a deployed instance over HTTPS. Only "add table" is available
today; see the [REST API documentation](rest-api/README.md) for deployment, authentication, and endpoint details. The

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This link is broken.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the link has been removed, we probably still need a link to the documentation from here?

Here's a link to the original thread: #7582 (comment)

@patchwork01 patchwork01 assigned ca61688 and unassigned patchwork01 Jul 14, 2026
@patchwork01 patchwork01 removed the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 14, 2026
Comment thread docs/usage/rest-api/add-table.md Outdated
@ca61688 ca61688 removed their assignment Jul 15, 2026
@ca61688 ca61688 added the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 15, 2026

@patchwork01 patchwork01 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I also commented on the thread on the bug fix: #7582 (comment)

instanceProperties = requireNonNull(builder.instanceProperties);
addTable = requireNonNull(builder.addTable);
// Fields may be null when this route is instantiated by the OpenAPI doc generator, which only invokes the
// openApi* methods below. handle() will fail with an NPE if the route is dispatched a request without them.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it feels clunky to support two different modes of instantiation. It feels misleading that some of the fields can be null, when they are required to be non-null for the class to work. It makes the class rather big. The OpenAPI definition isn't actually derived from anything in this class, so I think it doesn't look like it really needs to be all one class?

}

@Override
public Operation openApiOperation() {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think these OpenAPI definitions seem like a lot of overhead to require every time we add a new route. It also looks like a lot of work to keep them correct, and I can't see that being practical.

Everywhere I've seen this used, either source code was auto-generated from an OpenAPI definition, or the OpenAPI definition was derived from the source code for the actual endpoints. With this setup, it doesn't look like there's any check that these definitions are accurate? It also doesn't look like it's used for anything specific?

Does this follow AWS' recommendations for documentation of API Gateway REST APIs?

| Field | Type | Required | Description |
| ------------- | ----------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `properties` | object of string → string | Yes | Sleeper [table properties](../property-master.md). Must include `sleeper.table.name`; other properties fall back to instance defaults. |
| `schema` | object | Yes | The [Sleeper schema](../schema.md) for the new table. Any shape accepted by `SchemaSerDe` is accepted here. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think we can reference SchemaSerDe here, that's the source code and not user-facing. The schema format is documented in the linked file.

JSON
```

The instance property lookup above shells out to the config bucket; if you already have the URL to

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the use of "shells out" reads a bit oddly when we're already in a shell. The important bit is it retrieves the properties file from the config bucket.

Comment thread docs/usage/tables.md
`sendToIngestBatcher.sh`.

### Add table
#### Using the REST API

@patchwork01 patchwork01 Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure what you mean, I don't see a comment where I asked for that. When it was separate I commented that the way it was structured didn't fit with our existing documentation, I didn't suggest a particular change - #7582 (comment).

I think the problem here is there's a lot going on in this PR/issue, including the OpenAPI definitions and the bug fix, as well as the docs changes.

Here's a link to this thread if you're reading this in the review: #7582 (comment)

Comment thread docs/usage-guide.md Outdated
## REST API

Sleeper has an optional REST API for interacting with a deployed instance over HTTPS. Only "add table" is available
today; see the [REST API documentation](rest-api/README.md) for deployment, authentication, and endpoint details. The

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like the link has been removed, we probably still need a link to the documentation from here?

Here's a link to the original thread: #7582 (comment)

@patchwork01 patchwork01 removed the needs-reviewer Pull requests that need a reviewer to be assigned label Jul 15, 2026
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.

Document REST API to add a Sleeper table

3 participants