Граф коммитов

58 Коммитов

Автор SHA1 Сообщение Дата
Timothee Guerin b39abe5e63
Symbol refactor (#4849)
### Augment decorator issues
Fix https://github.com/microsoft/typespec/issues/4749 Augment/ref alias
properties
Fix https://github.com/microsoft/typespec/issues/2867 Augment/ref `model
is` properties
Fix https://github.com/microsoft/typespec/issues/4818 Augment/ref nested
model properties

### Circular reference issues
Fix https://github.com/microsoft/typespec/issues/4908 freeze when using
circular model extends with aliases

### Others
FIx https://github.com/microsoft/typespec/issues/4915 (Duplicate usings
not scoped per namespace)

Doesn't resolve the alias circular issue
https://github.com/microsoft/typespec/issues/2824 but I think setup the
solution for fixing it later in the name resolver where we could detect
that cycle instead of the checker

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-11-04 23:50:10 +00:00
Timothee Guerin bb7d035c56
Add blog back to astro (#4797) 2024-10-21 18:16:29 +00:00
Timothee Guerin 0c3cd362f5
Migrate website to astro [Step 1] (#4587)
Progress for #2564 
Changes: 
- Decided to cut versioning for now. Starlight doesn't support well now
and would be a decent amount of work. Our doc have been quite stable and
this slows down the build significantly.\


The plan is as follow
1. Merge this as a parallel build to the docusaurus website
2. Add blog back
3. Cleanup things (like migrate more things out of fluentui react
components)
4. Switch the website to use this one
5. If we are happy delete docusaurus
2024-10-11 01:38:03 +00:00
Sarangan Rajamanickam d9fb90397b
[@typespec/rest-specs] - Migrate cadl-ranch-specs package to typespec repository with server tests and framework (#4516)
This PR has the following changes:

1. Migrates the `cadl-ranch-specs ` package from the `cadl-ranch`
repository to this `typespec` repository.
2. Adds the server-test scenarios along with the framework to test those
scenarios.

In order to test the new server-test scenarios, there are 3 modes
enabled:

1. Specify the name of one scenario in the command line.
2. Specify the list of scenarios to be tested in a file and provide this
file as input in the command line
3. If the above modes are not specified, then the framework will execute
all the scenarios.

**Mode 1 - One Scenario in Command Line**

![Screenshot 2024-09-23
150451](https://github.com/user-attachments/assets/cd43c07c-1b37-4d5c-bd33-02c59e3539d1)

**Mode 2 - Multiple Scenarios in file** 

![Screenshot 2024-09-23
150615](https://github.com/user-attachments/assets/7b6be4f3-566d-48f4-bd36-cbbb91078339)

**Mode 3 - All Scenarios**

![Screenshot 2024-09-23
150636](https://github.com/user-attachments/assets/40263bf8-2cbb-4e4c-85ea-f1af634c6f42)

![Screenshot 2024-09-23
150749](https://github.com/user-attachments/assets/0d7fd055-de13-42f4-a4d6-85b837fec1e9)

This PR is equivalent of the PR
https://github.com/Azure/cadl-ranch/pull/729. Except for some cosmetic
changes in imports, etc, the code changes are same. I am doing the
changes in both to ensure both are in sync.
2024-09-30 17:17:20 +00:00
iscai-msft 8df0a9f000
Migrate python emitter (#4182)
Co-authored-by: iscai-msft <isabellavcai@gmail.com>
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
2024-09-18 19:44:40 +00:00
Weidong Xu b645fb3d6d
http-client-java, remove unused namer module (#4328)
History: we originally intend to use m4 prenamer (opt-in via
flag/option) to keep names in SDK same as from Swagger (mostly for
brownfield).

But later we decided to just use `@clientName` in client.tsp to
explicitly do the naming, if backward-compatibility is an issue.

This flag/option is not used by any service.
2024-09-04 23:12:53 +00:00
Srikanta c7ed92edbb
Java codegen: Run cadl ranch tests (#4303)
This PR enables starting the test server and running the Java tests
against the server.
2024-09-03 07:18:57 +00:00
Srikanta 7600a2bb58
Java Http client generator: generate tests (#4251) 2024-08-27 07:31:07 +00:00
Srikanta bf7866aa56
Add HTTP client generator for Java (#4185) 2024-08-16 18:24:23 +00:00
Srikanta b44b80fb4a
Migrate Java client emitter (#4045)
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-08-12 22:10:25 +00:00
m-nash e746179f66
Cadl ranch test framework (#3964)
Fixes https://github.com/microsoft/typespec/issues/3938
Fixes https://github.com/microsoft/typespec/issues/3337

- Will update coverage tracking for cadl ranch in this follow up issue
https://github.com/microsoft/typespec/issues/4012
- RestClient file is empty which will be addressed in this follow up
issue https://github.com/microsoft/typespec/issues/4016
2024-07-25 21:27:15 +00:00
Will Temple b5d766cd43
[http-server-javascript] Merge JavaScript Server Generator to Main (#3231)
This work-in-progress PR tracks merging the JavaScript server code
generator to the TypeSpec repository.

The JavaScript server code generator creates HTTP bindings for TypeSpec
HTTP services and exposes them for binding either to the Node.js http
server directly, or to an Express.js app as middleware.

Closes #3215

---------

Co-authored-by: Will Temple <will@wtemple.net>
2024-07-10 21:44:45 +00:00
m-nash 602fe73692
update to use comment ignores (#3607)
Auto merge happened right before this comment so fixing it here after
the fact
https://github.com/microsoft/typespec/pull/3590#discussion_r1643567703
2024-06-18 01:13:52 +00:00
m-nash 58654d6ba0
Initial changes for serialization helpers (#3590)
Fixes https://github.com/microsoft/typespec/issues/3580
Fixes https://github.com/microsoft/typespec/issues/3536
2024-06-17 23:56:45 +00:00
m-nash 76472cce78
Initial set up to add perf tests (#3474)
Add a place to add perf tests for using benchmark to evaluate
performance impacts
2024-05-30 21:45:39 +00:00
Brian Terlson 9a109906a0
Fix bundling and inlining of referenced schemas (#3430)
Fixes #3369 by changing how types are bundled. In particular, when a
type is not a JSON Schema type, we never create a root schema for it.
Instead, it is inlined into the defs of any schema which references it,
and referenced using a JSON pointer. This PR makes bundling have
essentially no impact on emitted schemas, and is merely a way to bundle
them into a single file.

The approach is as follows:

* When a type references another type outside a JSON Schema namespace,
include the referenced type under $defs:
   * Such referenced types do not have a $id or $schema field
   * Such referenced types are referenced via JSON pointers not ids
* Bundling does not alter the bundled schemas or introduce new root
schemas. This changes two things from what we do today:
* The `$id` of the bundled schemas now includes the file path as it does
for non-bundled schemas (whereas before it was just the type name)
* non-JSON Schema types do not get $defs in the bundle, so the bundle
has the same root schemas as would be written to disk when not bundling.
  
In terms of implementation, the basic approach is to not handle bundling
via the emitter framework source files. Instead, we always create source
files for root schemas, and inline the necessary defs as we did before
(but now using JSON pointers). Then when we're about to write source
files, if we're bundling we assemble the bundle and emit that single
file, otherwise we emit each source file that contains a root schema.

Todo: 

* [ ] Validate that the bundled schemas continue to work with ajv.
* [ ] Cleanups

---------

Co-authored-by: Vitalii Kryvenko <gersoh3@gmail.com>
2024-05-24 00:49:43 +00:00
Timothee Guerin 76375a80f4
Add dev container configuration for repo (#3440)
This should help opening PR in codespaces as well as helping new
contributors
2024-05-24 00:20:36 +00:00
Timothee Guerin eba81f0255
Run all if vitest.config.ts change (#3411) 2024-05-21 17:49:46 +00:00
Timothee Guerin eac8011448
Add generated policy to remove needs-triage when an area is added (#3366)
Generate the Microsoft policy service files to automatically to:
- add/remove `needs-triage` automatically when there is no area or an
area is added
- add the area on PRs


resolve #3340
2024-05-16 22:55:52 +00:00
m-nash 52377dda44
Run apiview checks in pr to detect public api changes (#3283)
Fixes https://github.com/microsoft/typespec/issues/3203
Fixes https://github.com/microsoft/typespec/issues/3207
2024-05-10 01:02:05 +00:00
Jorge Rangel 70348b336d
feat: enhance summary for binarydata props (#3289)
This PR enhances the description of model properties that are of type
`BinaryData`.
2024-05-09 18:07:44 +00:00
Timothee Guerin 21edcb8f76
Add release notes for 0.56.0 (#3294)
Fixed up cspell not validating `.chronus` and causing some typo in
release notes

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-05-07 21:02:14 +00:00
Timothee Guerin a98f35cea2
Migrate csharp emitter to vitest and remove lodash (#3118)
Fixes https://github.com/microsoft/typespec/issues/3108
2024-04-05 17:26:23 +00:00
m-nash 0889ba248c
Initial move of csharp client emitter (#3098)
Fixes https://github.com/microsoft/typespec/issues/3095

---------

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
Co-authored-by: Patrick Hallisey <hallipr@gmail.com>
2024-04-04 16:26:05 -07:00
Patrick Hallisey ffa80ee8a4
Use 1es templates (#3036)
Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2024-04-03 14:04:47 -07:00
Timothee Guerin a9696087af
Add monarch tokenizer as a dedicated package (#3079)
Package is private for now, this is just a way to maintain the tokenizer
on our side
2024-03-29 10:25:29 -07:00
Timothee Guerin 814e518ac9
Accessibility contrast tweaks (#3026)
- Make the light code theme have accessible contrast.
- Docsearch placeholder contrast tweak

Also minor tweak to the prismjs tokenizer to fix optional property
highlighting
2024-03-18 16:23:00 +00:00
Timothee Guerin 57f0d47bef
Integrate 1ds telemetry in website (#2912) 2024-03-08 17:41:55 +00:00
Timothee Guerin 8b062e33bb
Update http authentication docs with new operation level auth and scopes (#2960)
PR added support for it but we need to update the docs to explain the
new feature.

---------

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
2024-02-28 19:40:28 +00:00
Timothee Guerin da70950269
Sign VSCode and Visual Studio extensions & pipeline organization (#2913)
Add steps to sign the extensions

## Reorganize pipelines 

This is a part of the change done here
https://github.com/microsoft/typespec/pull/2869 without separating the
npm publish into its own publish stage as this wasn't that easy with
pure pnpm and the esrp release task isn;t supporting custom tags yet.
<img width="539" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/57b3ab2a-846c-4f9a-83fb-f8c8ef17434d">
2024-02-15 19:24:06 +00:00
Timothee Guerin afd377242e
Include tmlanguage computed file in repo as we'll need it for github linguist (#2872)
To register a tm language on github linguist we need to publish our
grammar.
Instructions
https://github.com/github-linguist/linguist/blob/master/CONTRIBUTING.md#adding-a-language
2024-02-09 04:07:46 +00:00
Timothee Guerin a1eb851cc3
Enable spell check for all files and fix (#2881)
fix #2776
2024-02-08 16:54:23 -08:00
Timothee Guerin 8ed1d82e7c
Add support for openIdConnect auth scheme (#2811)
fix [#2774](https://github.com/microsoft/typespec/issues/2774)
2024-02-05 14:38:55 -08:00
Timothee Guerin 0f54035125
Publish Visual Studio Extension (#2854)
closes #527
2024-01-30 11:17:38 -08:00
Timothee Guerin 63f7e546fd
Vscode publish (#2838)
Extension
https://marketplace.visualstudio.com/items?itemName=typespec.typespec-vscode
2024-01-29 22:01:33 +00:00
Timothee Guerin 842405e8d1
Get rid of rush and move to pnpm (#2775)
Remove the opinionated (wrongly so most of the time) middleman that
brings more config pain than value.

Things to check:
- [x] Parallel build performance vs rush
- [ ] Publishing with submodule
- [x] Changesets
2024-01-24 13:37:34 -08:00
Timothee Guerin 5af94f0762
Website public beta (#2418)
This is a feature branch containing the progress for the website

URL: https://tspwebsitepr.z22.web.core.windows.net/prs/2418/
2024-01-19 09:42:25 -08:00
Timothee Guerin 9c7bf80187
Migrate test framework to vitest (#2769)
Get rid of mocha and upgrade to vitest which is a more modern
alternative providing, watch, direct typescript compilation out of the
box, expect library and more.

Advantage over mocha:
- Much better cli
  -  watch mode
  - better diff
- Better extension:
  -  tree organization for files too (not everything flattened)
- update in real time the test(no more need to refresh manually to
discover where are the tests)
  - just a little buggy
- Compiles typescript directly
- provides more expectation apis(like jest)

Cons over mocha: 
- Slower(about 2x) but that means we don't need to build the test as
part of build which would speed up that part(not as much as is lost)

Todo: 
- typespec-azure migration
2024-01-02 11:40:29 -08:00
Travis Prescott 42545acd3b
Improve Emitter/Library authoring documentation (#2725)
Fixes #2728.

---------

Co-authored-by: Timothee Guerin <tiguerin@microsoft.com>
2023-12-14 21:48:27 +00:00
Timothee Guerin 211ca4fda3
Fix prismjs string template literal regex (#2719)
Those regex were reporting to have some vulnerability for performance,
not sure if this fixes it but I think those were errors to start with
and this is the way the swift prism definition does with with `\(`
instead of `${`

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-12-05 09:30:13 -08:00
Timothee Guerin f646e1924a
Use workflow for codeql configuration (#2720)
Somehow the default UI configuration doesn't run on pull requests so
hopefully this will work.

Right now we just get the security warnings after merging which is
unfortunate. It is also hard to run codeql locally so having it on a PR
to make sure we resolve it is nice

We'll get error like that
<img width="993" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/e1ff03d0-1f6a-49e5-8b27-b7c03e2b69f2">
2023-12-04 17:18:34 -08:00
Timothee Guerin dea0c83804
Docs: multipart default handling (#2667)
part of https://github.com/microsoft/typespec/issues/2419


https://tspwebsitepr.z22.web.core.windows.net/prs/2667/next/standard-library/http/multipart.html

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-11-21 19:37:05 +00:00
Timothee Guerin 86569b3f57
Playground version picker (#2661)
fix https://github.com/microsoft/typespec/issues/2044

<img width="456" alt="image"
src="https://github.com/microsoft/typespec/assets/1031227/63f2b07f-7eba-4d0f-9bbd-2ef6348efd4c">
2023-11-17 08:04:18 -08:00
Mike Harder 746d080797
Use "c8" to merge coverage files (#2432)
- Fixes Azure/typespec-azure#3582
2023-09-19 18:38:42 +00:00
Timothee Guerin adbb1559cd
Rename `ref-doc` package to `tspd` and provide a cli that can be used by each package (#2225)
Progress towards providing the ref doc generation as a usable tool by
any typespec library.

Detach the generation from the website, instead each package define
where they want their doc and we generate it.

This adds a new `tspd` package and CLI tool that is meant to be used by
library authors. It will have the following functionalities
- generate docs
- generate TS signatures
- lint library?

---------

Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
2023-08-01 22:34:18 +00:00
Travis Prescott d67c95e054
Collection Format updates (#2197)
Closes #1711.


[Playground](https://cadlplayground.z22.web.core.windows.net/prs/2197/?c=aW1wb3J0ICJAdHlwZXNwZWMvaHR0cCI7DQoNCnVzaW5nIFR5cGVTcGVjLkh0dHDFGG9wIHRlc3QoQHF1ZXJ5KHtuYW1lOiAiJHNlbGVjdCIsIGZvcm1hdDogInRzdiJ9KSDGGXM6IHN0cmluZ1tdKcgLOw%3D%3D&e=%40typespec%2Fopenapi3&options=%7B%7D)
2023-07-26 22:21:45 +00:00
Timothee Guerin 1ef3283e01
Fix: Linking example from url (#1872) 2023-05-05 23:06:30 +00:00
Travis Prescott 48a14923ba
Enforce fixes for missing docs (#1860)
* Add doc errors for decorators and decorator parameters.

* Add decorator documentation rules.

* Code review feedback.

* Update logic.

* Compiler docs fixes.

* Doc updates.

* Fix protobuf issues.

* Code review feedback.

* Test that build fails...

* Add support for scalars.

* I hate EVERYTHING about you, cSpell....

* Code review feedback.
2023-04-28 09:32:54 -07:00
Will Temple e0b480de8f
[gRPC] @typespec/protobuf (#636)
* gRPC: initial commit moving from demo to public repo

* Added a README

* remove copied changelogs

* added fresh changelog.json

* Some cleanup, removed synthetic models

* WIP testing system

* Recorded a test

* Fixed bug bypassing effective type calculation.

* Made 'simple' even simpler.

* Added test for inferring message names from context

* Supported output message name inference and refactored unreachable types.

* Unleaked discriminated union tags.

* Updated some documentation.

* Capitalize method names, remove space between method name and input type.

* Tweaked proto header

* Extracted writing reservations into own function

* Taught the expectation system to look for diagnostics.

* Check for namespace collisions.

* Fixed simple-error test

* Re-recorded a simple test.

* Renamed grpc -> protobuf, improved handling of many protobuf features

* Implement cross-package references

* Reworked a bunch of docs issues and diagnostics.

* Lazy initialize scalars map

* Some doc updates

* Removed protoc output

* Renamed tests to .tsp

* Updated diagnostics and some documentation

* Updated entrypoint from typespecMain to tspMain

* Updated docs

* Lint/spell fixes

* Updated enum error messages

* Improved namespace handling

* Reject anonymous models in messages

* Removed TODOs

* Fixed test harness on windows

* addressbook scenario

* Several small updates

* Ignored .protoc-out integration folder

* Updated a few documentation entries

* Import from fs rather than import fs

* Increased resilience to failed scalar resolutions.

* Support derived scalars by traversing the scalar inheritance links.

* Add protobuf as website dependency

* Just don't support unions for now

* Better handling of intrinsic types

* Added a note about onValidate

* Added a note about syntax target functions

* Move a symbol

* Add a readme warning.
2023-04-25 16:23:51 +00:00
Brian Terlson a5d648c956
Add relative path utils, allow initializing an object builder from a placeholder, and fix some bugs (#1839) 2023-04-21 22:39:29 +00:00