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

Move Json domain from test to internal #23043

Merged
merged 14 commits into from
Feb 25, 2025

Conversation

CraigMacomber
Copy link
Contributor

@CraigMacomber CraigMacomber commented Nov 8, 2024

Description

Export Json domain as internal. This is a step toward making it alpha, but that will involve more tweaking of naming/scoping.

This makes it easy for users to embed JSON content in their trees.

This could be followed up with a similar domain for fluid serializable content which is the same but allows handles: this will be needed for map -> tree adapters.

Reviewer Guidance

The review process is outlined on this wiki page.

@github-actions github-actions bot added area: dds Issues related to distributed data structures area: dds: tree area: dev experience Improving the experience of devs building on top of fluid area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct public api change Changes to a public API base: main PRs targeted against main branch labels Nov 8, 2024
Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

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

Code Coverage Summary

↓ packages.dds.tree.src:
Line Coverage Change: -6.14%    Branch Coverage Change: No change
Metric NameBaseline coveragePR coverageCoverage Diff
Branch Coverage 100.00% 100.00% → No change
Line Coverage 100.00% 93.86% ↓ -6.14%

Baseline commit: aa84db1
Baseline build: 305550
Happy Coding!!

Code coverage comparison check failed!!
More Details: Readme

  • Skip This Check!!

What to do if the code coverage check fails:

  • Ideally, add more tests to increase the code coverage for the package(s) whose code-coverage regressed.

  • If a regression is causing the build to fail and is due to removal of tests, removal of code with lots of tests or any other valid reason, there is a checkbox further up in this comment that determines if the code coverage check should fail the build or not. You can check the box and trigger the build again. The test coverage analysis will still be done, but it will not fail the build if a regression is detected.

  • Unchecking the checkbox and triggering another build should go back to failing the build if a test-coverage regression is detected.

  • You can check which lines are covered or not covered by your tests with these steps:

    • Go to the PR ADO build.
    • Click on the link to see its published artifacts. You will see an artifact named codeCoverageAnalysis, which you can expand to reach to a particular source file's coverage html which will show which lines are covered/not covered by your tests.
    • You can also run different kind of tests locally with :coverage tests commands to find out the coverage.

@CraigMacomber CraigMacomber reopened this Feb 20, 2025
@github-actions github-actions bot added area: examples Changes that focus on our examples and removed area: dev experience Improving the experience of devs building on top of fluid labels Feb 20, 2025
@CraigMacomber CraigMacomber marked this pull request as ready for review February 20, 2025 23:03
@CraigMacomber CraigMacomber requested a review from a team as a code owner February 20, 2025 23:03
* ```
* @alpha
*/
export const JsonUnion = [() => JsonObject, () => JsonArray, ...JsonPrimitive] as const;
Copy link
Contributor

Choose a reason for hiding this comment

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

My vote would be to call this Json or JsonTree. The term "Union", while correct, is more mechanical than it is semantic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think having a top level package export called Json is a great idea. JS already has JSON, and our package has lots of Json related stuff other than this. JsonTree also seems questionable as VerboseTree and ConciseTree are both Json tree formats, and this is nothing like them. If changing this, I'd lean in the direction of making it more explicitly not named like that.

Copy link
Contributor

@Josmithr Josmithr Feb 24, 2025

Choose a reason for hiding this comment

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

If we want to be more careful / explicit with the naming, we could possibly do something like JsonDomainTree. I agree that JsonUnion doesn't really convey the semantics we want here.

But of the existing suggestions, I like JsonTree the best personally.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think JsonDomain really does it either. Its perfectly reasonable to think of VerboseTree and ConciseTree as projections of trees into the JSON domain. This format on the other hand isn't even a JSON style object since it uses maps for objects.

Maybe JsonAsTree for JsonUnion, and JsonObjectAsTree for JsonObject?

Another approach would be to go with a namespace. Since everything in it needs the same release tag, I think we can make that work. In that case maybe JsonDomain, with a big doc comment on the namespace, would work, then the members could have short names like Object, Union/Tree, Array, etc.?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think namespaces will break re-exports in fluid-framework 😕
microsoft/rushstack#4807

Copy link
Contributor

Choose a reason for hiding this comment

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

Or, well, maybe not, since we're generating our own rollups now. I'm not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

But I do like namespaces for things like this. JsonAsTree also seems reasonable to me.

Copy link
Contributor

@noencke noencke left a comment

Choose a reason for hiding this comment

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

I think this is a good addition to our available toolset.

We may want to consider writing a short guide on how to use this domain (kind of like the examples you provided, but a little more comprehensive) and which also clarifies how this "JSON" domain is a different thing than merely the fact that a SharedTree's data is, to some degree, natively compatible with "JSON" in its API and exposed data model - to avoid any confusion. That's something we can think about later, when this API is promoted to beta.

Copy link
Contributor

🔗 Found some broken links! 💔

Run a link check locally to find them. See
https://github.com/microsoft/FluidFramework/wiki/Checking-for-broken-links-in-the-documentation for more information.

linkcheck output


> [email protected] ci:check-links /home/runner/work/FluidFramework/FluidFramework/docs
> start-server-and-test "npm run serve -- --no-open" 3000 check-links

1: starting server using command "npm run serve -- --no-open"
and when url "[ 'http://127.0.0.1:3000' ]" is responding with HTTP status code 200
running tests using command "npm run check-links"


> [email protected] serve
> docusaurus serve --no-open

[SUCCESS] Serving "build" directory at: http://localhost:3000/

> [email protected] check-links
> linkcheck http://localhost:3000 --skip-file skipped-urls.txt

Crawling...

http://localhost:3000/docs/data-structures/tree
- (36:97) 'the Shar..' => http://localhost:3000/docs/api/tree (HTTP 404)

http://localhost:3000/docs/data-structures/tree/
- (36:97) 'the Shar..' => http://localhost:3000/docs/api/tree (HTTP 404)

http://localhost:3000/docs/data-structures/tree/schema-definition
- (30:128) 'SharedTr..' => http://localhost:3000/docs/api/tree (HTTP 404)

http://localhost:3000/docs/start/tree-start
- (44:4) 'the API ..' => http://localhost:3000/docs/api/tree/schemafactory-class (HTTP 404)
- (61:7) 'the API' => http://localhost:3000/docs/api/tree/treechangeevents-interface (HTTP 404)


Stats:
  158264 links
    1304 destination URLs
    1535 URLs ignored
       0 warnings
       3 errors

 ELIFECYCLE  Command failed with exit code 1.

@CraigMacomber CraigMacomber changed the title feat: Export Json domain as alpha Move Json domain from test to internal Feb 25, 2025
@github-actions github-actions bot removed public api change Changes to a public API area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct labels Feb 25, 2025
@CraigMacomber CraigMacomber enabled auto-merge (squash) February 25, 2025 21:20
@CraigMacomber CraigMacomber merged commit bda636c into microsoft:main Feb 25, 2025
33 checks passed
chentong7 pushed a commit to chentong7/FluidFramework that referenced this pull request Mar 11, 2025
## Description

Export Json domain as internal. This is a step toward making it alpha,
but that will involve more tweaking of naming/scoping.

This makes it easy for users to embed JSON content in their trees.

This could be followed up with a similar domain for fluid serializable
content which is the same but allows handles: this will be needed for
map -> tree adapters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: tree area: dds Issues related to distributed data structures area: examples Changes that focus on our examples base: main PRs targeted against main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants