Repository navigation
Conversation
The v1 API now returns a url on every workspace that opens it directly in Polyscope (beyondcode/polyscope-website#97). Declaring it on the Workspace resource gives IDE and PHPStan support and a null default when an older API response leaves it out, instead of an undefined property warning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The v1 API now returns a link on every workspace that opens it directly in Polyscope (beyondcode/polyscope-website#97). The SDK already picked it up as a dynamic property. But IDEs and PHPStan didn't know it existed, and reading it from an older API response raised an "Undefined property" warning. Now it's a declared, nullable property on the
Workspaceresource.How to verify
https://getpolyscope.com/servers/<server_id>/session?workspace=<id>.Polyscope::workspaces()andPolyscope::createWorkspace([...])return the sameurlfor that workspace.Automated coverage
urlmapped on list, create and show: covered —test_listing_workspaces_maps_urlintests/PolyscopeSDKTest.phpchecks all three in one testnullwhen the API leavesurlout: partly covered — same test. Without the property declared it reports a PHPUnit warning, not a failure, becausephpunit.xml.distdoesn't setfailOnWarning(checked:Tests: 1, Assertions: 4, Warnings: 1)Measured: 15 tests, 82 assertions passing on PHP 8.4.27; PHPStan level 5 clean.
Technical notes
src/Resources/Workspace.php:17.Resource::fill()camel-cases every key, so no mapping code is needed.tests/PolyscopeSDKTest.php. Whichever lands second needs a trivial rebase.Follow-ups
beyondcode/polyscope-website: the "Getting a Single Workspace" example inresources/docs/integrations/laravel-php-sdk.mddoesn't show$workspace->urlyet.