swagger-ui-react pull in all the swagger ui dependencies which is a bit
anyoing as they are mostly optional and with pnpm requires you to build
native dependencies.
Setup a workaround for the fact that vitest(vite underneath) doesn't
ever want to reload files in the outDir
https://github.com/vitest-dev/vitest/issues/5429
as the outDir isn't actually used in vitest(as far as I understand) this
is just an ok workaround.
fix#3073
This still doesn't provide an optimal experience as the error shows up
on the void type instead of where it is referenced but solving that is
that long standing issue about tracing back where an error should be
fix [#2946](https://github.com/microsoft/typespec/issues/2946)
Problem was that in the projector were were calling to this helper to
see if that was a type that we should finish but it was missing the
union case causing union template declaration from being finished in the
projector and then being shown as finished type in the semantic
navigator and crashing openapi3 emitter.
fix#2217
This isn't fully accurate as it is saying in openapi3 that it can be
anything and `null` but this solve a crash, we could consider adding a
warning
---------
Co-authored-by: Mark Cowlishaw <markcowl@microsoft.com>
Note this is added to `tspd` which is not published yet so this can be
iterated over without any issues.
Adds a decorator signature generator. Generates 2 files:
- `<namespace>.ts` : Contains the decorator signatures that can be
imported and when declaring the decorators functions
- `<namespace>.ts-test.ts`: Contains some test using typescript type
system to make sure the package does reexport the right `$<name>` for
each decorator
---------
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
Co-authored-by: Mario Guerra <85648637+mario-guerra@users.noreply.github.com>
Co-authored-by: Libba Lawrence <llawrence@microsoft.com>
Co-authored-by: Allen Zhang <allenzhang@live.com>
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
fix [#2821](https://github.com/microsoft/typespec/issues/2821)
## Deprecate `@service({version`
Using this property will emit a deprecation warning
## Cover everything with `@OpenAPI.info`
Makes sure all the properties allowed on the `info` object of openapi
specification can also be provided in `@info`. The properties will
either override other ways of specifying those previously or be the only
way.
- `@info({description` would override `@doc` on service namespace
- `@info({summary` would override `@summary` on service namespace
- `@info({title` would override `@service({title}` on service namespace
fix [#2925](https://github.com/microsoft/typespec/issues/2925)
Stop emitting the error if there is a shared route and a non shared
route on a different verb.
Also improve the error:
- change message to be a little more clear
- emit the error on every offending operation not just the first one we
find an duplicate
---------
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
fix#2787
having multiple has no effect, the latest value will override the
previous ones so there is no reason to use `@useAuth` twice on the same
node
---------
Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
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>
Hi! 🖖🏻
This PR resolves#2624 by implementing the [design
doc](https://gist.github.com/timotheeguerin/56690786e61a436710dd647de9febc0f),
but in its initial form:
- `@useAuth` can now be applied not only to service namespace, but to
interfaces and operations as well. Its arguments override all
authentication, which was set for enclosing scopes.
- OAuth2 scopes can now be set at operation level (though, the code
doing this in OpenAPI emitter is a bit clunky).
- New `NoAuth` authentication option allows to declare optional
authentication (`NoAuth | AnyOtherAuth`) or override authentication to
none in nested scopes.
This implementation does not introduce new `@authScopes` decorator as
design doc comments suggest, and here's why:
1. It does not compose well with `@useAuth` at operation level. For
example
```
...
@useAuth(BasicAuth)
@authScopes(MyOauth2, ["read"])
op gogo(): void
```
Should that be equivalent to `BasicAuth | MyOauth2`, or to `[BasicAuth,
MyOauth2]`?
2. Introducing new decorator would increase complexity, but (imho) it
would not reduce the amount of boilerplate:
```
alias MyOAuth2 = OAuth2Auth<{ ... }>;
@useAuth(MyOAuth2)
@authAcopes(MyOauth2, ["read"])
@service
namepsace Foo;
```
vs
```
model MyOAuth2Flow<T extends string[]> { ... };
alias MyOauth2<T extends string[]> = Oauth2Auth<[MyOauth2Flow[T]]>
@useAuth(MyOAuth2<["read"]>)
@service
namepsace Foo
```
I would be happy to hear any feedback and apply suggested changes.
And thanks for a convenient development setup and thorough test
coverage!
---------
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
This function is useful when you want to work with the OpenAPI 3
directly, or don't want to write it to disk for some reason.
---------
Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
Provide a new exports `/utils` where we can export utils that are
commonly used in libraries and emitters but not tied to typespec
directly(deepClone, deepEquals, etc.)