Skip to content

Convert Fabric APIs to TypeSpec #373

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

Merged
merged 44 commits into from
Jul 17, 2025
Merged

Convert Fabric APIs to TypeSpec #373

merged 44 commits into from
Jul 17, 2025

Conversation

Devon-White
Copy link
Contributor

REST API Update Pull Request

Description

Convert all Fabric APIs to TypeSpec

Type of Change

  • New endpoint
  • Update to existing endpoint

Motivation and Context

We want to live in a world of only TypeSpec

Checklist:

  • I have read and fully understand the process for updating the REST API
  • Mandatory fields are present in the TypeSpec files.
  • TypeSpec files successfully compiled OpenAPI spec files.
    • No new warnings were generated during the compilation process.
  • OpenAPI spec files were validated with a SWAGGER UI tool to ensure they are correct.
  • The DevEx team has been alerted with the new changed by including the team/developer-experience label in the PR.

Copy link

netlify bot commented Jul 9, 2025

Deploy Preview for signalwire-docs ready!

Name Link
🔨 Latest commit 1c1584d
🔍 Latest deploy log https://app.netlify.com/projects/signalwire-docs/deploys/68791f9cedb5e80009c45cab
😎 Deploy Preview https://deploy-preview-373--signalwire-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 32 (🟢 up 6 from production)
Accessibility: 91 (no change from production)
Best Practices: 92 (no change from production)
SEO: 89 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

github-actions bot commented Jul 9, 2025

yarn run v1.22.22
$ /home/runner/work/docs/docs/node_modules/.bin/ts-node tools/scripts/generate-matrix.ts

OpenAPI Specification Analysis

Changes are compared to the main branch:

  • 🟢 Improvements (higher scores or fewer issues)
  • 🔴 Regressions (lower scores or more issues)
  • ⚪ No changes
Spec Docs Completeness SDK Gen Security Overall Warnings Errors Report
specs/compatibility-api/_spec_.yaml 72/100
(=) ⚪
69/100
(=) ⚪
79/100
(=) ⚪
39/100
(=) ⚪
65/100
(=) ⚪
448
(=) ⚪
360
(=) ⚪
View
specs/signalwire-rest/calling-api/tsp-output/@typespec/openapi3/openapi.yaml 98/100
(=) ⚪
95/100
(=) ⚪
100/100
(+3.0) 🟢
52/100
(=) ⚪
86/100
(=) ⚪
16
(-4) 🟢
5
(=) ⚪
View
specs/signalwire-rest/chat-api/tsp-output/@typespec/openapi3/openapi.yaml 98/100
(=) ⚪
95/100
(=) ⚪
100/100
(+3.0) 🟢
52/100
(=) ⚪
86/100
(=) ⚪
10
(-2) 🟢
3
(=) ⚪
View
specs/signalwire-rest/datasphere-api/tsp-output/@typespec/openapi3/openapi.yaml 97/100
(=) ⚪
94/100
(=) ⚪
100/100
(+4.0) 🟢
52/100
(=) ⚪
86/100
(+1.0) 🟢
49
(-16) 🟢
17
(=) ⚪
View
specs/signalwire-rest/fabric-api/tsp-output/@typespec/openapi3/openapi.yaml 99/100
(+4.0) 🟢
99/100
(+7.0) 🟢
100/100
(+4.0) 🟢
84/100
(+32.0) 🟢
95/100
(+11.0) 🟢
557
(+232) 🔴
2
(-91) 🟢
View
specs/signalwire-rest/fax-api/_spec_.yaml 38/100
(=) ⚪
35/100
(=) ⚪
86/100
(=) ⚪
39/100
(=) ⚪
50/100
(=) ⚪
18
(=) ⚪
15
(=) ⚪
View
specs/signalwire-rest/logs-api/tsp-output/@typespec/openapi3/openapi.yaml 98/100
(=) ⚪
95/100
(=) ⚪
100/100
(+4.0) 🟢
52/100
(=) ⚪
86/100
(+1.0) 🟢
9
(-2) 🟢
4
(=) ⚪
View
specs/signalwire-rest/message-api/_spec_.yaml 53/100
(=) ⚪
50/100
(=) ⚪
86/100
(=) ⚪
38/100
(=) ⚪
57/100
(=) ⚪
18
(=) ⚪
11
(=) ⚪
View
specs/signalwire-rest/project-api/_spec_.yaml 76/100
(=) ⚪
73/100
(=) ⚪
69/100
(=) ⚪
36/100
(=) ⚪
64/100
(=) ⚪
21
(=) ⚪
14
(=) ⚪
View
specs/signalwire-rest/pubsub-api/_spec_.yaml 98/100
(=) ⚪
95/100
(=) ⚪
88/100
(=) ⚪
36/100
(=) ⚪
80/100
(=) ⚪
11
(=) ⚪
6
(=) ⚪
View
specs/signalwire-rest/space-api/_spec_.yaml 75/100
(=) ⚪
72/100
(=) ⚪
88/100
(=) ⚪
40/100
(=) ⚪
69/100
(=) ⚪
372
(=) ⚪
271
(=) ⚪
View
specs/signalwire-rest/video-api/_spec_.yaml 86/100
(=) ⚪
85/100
(=) ⚪
86/100
(=) ⚪
39/100
(=) ⚪
74/100
(=) ⚪
179
(=) ⚪
131
(=) ⚪
View
specs/signalwire-rest/voice-api/_spec_.yaml 53/100
(=) ⚪
50/100
(=) ⚪
86/100
(=) ⚪
38/100
(=) ⚪
57/100
(=) ⚪
18
(=) ⚪
11
(=) ⚪
View

Done in 152.43s.

@Devon-White Devon-White changed the title Devon/fabric typespec WIP - Convert Fabric APIs to TypeSpec Jul 9, 2025
@Devon-White Devon-White requested a review from a team July 9, 2025 19:40
@Devon-White
Copy link
Contributor Author

Should fix some of the errors in the OpenAPI report while im already here and working on this

Copy link
Contributor

@cassieemb cassieemb left a comment

Choose a reason for hiding this comment

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

I'm very sorry for all the comments, please feel free to ask for clarification on anything! I know I made a few as notes and I will come back to those shortly.

I think this is looking great overall! I think there are some copy paste issues, and a few endpoints with the wrong bodies.

These also don't feel clearly represented to me, but I might have missed it:

https://developer.signalwire.com/rest/signalwire-rest/endpoints/fabric/assign-resource-to-phone-route/

https://developer.signalwire.com/rest/signalwire-rest/endpoints/fabric/assign-resource-to-domain-application/

https://developer.signalwire.com/rest/signalwire-rest/endpoints/fabric/assign-resource-to-sip-endpoint

Copy link
Contributor

@imfaruk imfaruk left a comment

Choose a reason for hiding this comment

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

Looking really great!

Few concerns:

  • Endpoints of this format api/fabric/resources/{resourceable}/{resource_id}/addresses uses Basic Auth
  • /api/fabric/addresses uses Bearer Token
  • Some of the @summary and @doc ends with a full stop(.) others don't. I myself introduced this inconsistency in many places before.

Devon-White and others added 8 commits July 11, 2025 17:20
- Introduced Ciphers enum with various AES cipher options.
- Added Codecs enum for audio and video codecs including PCMU, PCMA, G722, G729, OPUS, VP8, and H264.
- Created Encryption enum to define encryption requirements: Required, Optional, and Default.
@Devon-White Devon-White changed the title WIP - Convert Fabric APIs to TypeSpec Convert Fabric APIs to TypeSpec Jul 17, 2025
diego-signalwire and others added 2 commits July 17, 2025 08:38
* Add status callback fields to CXML and SWML Scripts endpoints

* Update core.tsp

* Update specs/signalwire-rest/fabric-api/cxml-scripts/models/requests.tsp

* Update specs/signalwire-rest/fabric-api/cxml-scripts/models/requests.tsp

* Update specs/signalwire-rest/fabric-api/swml-scripts/models/requests.tsp

* Update specs/signalwire-rest/fabric-api/swml-scripts/models/requests.tsp

---------

Co-authored-by: Devon <[email protected]>
briankwest
briankwest previously approved these changes Jul 17, 2025
Copy link
Contributor

@cassieemb cassieemb 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 looks great, really nice work with this!! I'm a big fan of how you organized the documentation as well, it's a very clean look.

I have a few nits but 99.9% of them are missing new lines, so hopefully that's easy to update across all of them at once! 😅

The missing new lines can cause problems in prime, but if it doesn't for Docusaurus, let me know and I'm happy to approve without those changes.

My one thought is that it could be helpful if we put SWML Scripts and SWML Webhooks together here, like you did with all the CXML resource types. However, I wouldn't block on this!

Screenshot 2025-07-17 at 10 15 35 AM

@Devon-White
Copy link
Contributor Author

I think this looks great, really nice work with this!! I'm a big fan of how you organized the documentation as well, it's a very clean look.

I have a few nits but 99.9% of them are missing new lines, so hopefully that's easy to update across all of them at once! 😅

The missing new lines can cause problems in prime, but if it doesn't for Docusaurus, let me know and I'm happy to approve without those changes.

My one thought is that it could be helpful if we put SWML Scripts and SWML Webhooks together here, like you did with all the CXML resource types. However, I wouldn't block on this!

Screenshot 2025-07-17 at 10 15 35 AM

It seems TypeSpec actually doesnt care for newlines.

I was curious to see if their formatter would fix this for us automatically: https://typespec.io/docs/handbook/formatter/

Testing this in the SWML schema repo, i found it actively removes them when present:

image

I think we are good to ignore newlines in this case, however, if we wanted to add a code style rule to include newlines so we are consistent with your rules, we can add a custom linter: https://typespec.io/docs/extending-typespec/linters/

@cassieemb
Copy link
Contributor

I think this looks great, really nice work with this!! I'm a big fan of how you organized the documentation as well, it's a very clean look.
I have a few nits but 99.9% of them are missing new lines, so hopefully that's easy to update across all of them at once! 😅
The missing new lines can cause problems in prime, but if it doesn't for Docusaurus, let me know and I'm happy to approve without those changes.
My one thought is that it could be helpful if we put SWML Scripts and SWML Webhooks together here, like you did with all the CXML resource types. However, I wouldn't block on this!
Screenshot 2025-07-17 at 10 15 35 AM

It seems TypeSpec actually doesnt care for newlines.

I was curious to see if their formatter would fix this for us automatically: https://typespec.io/docs/handbook/formatter/

Testing this in the SWML schema repo, i found it actively removes them when present:

image I think we are good to ignore newlines in this case, however, if we wanted to add a code style rule to include newlines so we are consistent with your rules, we can add a custom linter: https://typespec.io/docs/extending-typespec/linters/

Sounds good to me! I will resolve all the new line comments

@briankwest briankwest self-requested a review July 17, 2025 17:08
@Devon-White Devon-White merged commit 6e17a94 into main Jul 17, 2025
6 checks passed
@Devon-White Devon-White deleted the Devon/fabric-typespec branch July 17, 2025 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants