sdkgen is a tool to help design, implement and maintain good APIs with minimal effort
MIT License
Bot releases are hidden (Show)
Published by lbguilherme almost 4 years ago
Documentação! (#120)
Temos agora uma documentação nova e escrita em português para o sdkgen. Ainda será foco das próximas releases para garantir que contenha toda a informação necessária para utilizar a manipular o sdkgen. Contribuições serão sempre bem-vindas.
Confira em: https://sdkgen.github.io
Dados adicionais em erros (#133)
No sdkgen sempre foi possível definir tipos de erro:
error InvalidArgument
Agora é possível incluir dados adicionais (de qualquer tipo) junto com um erro:
error InvalidArgument {
argumentName: string
reason: string
}
E o erro pode ser lançado como:
throw new InvalidArgument("Argumento inválido!", { argumentName: "amount", reason: "Deve ser positivo" });
Qualquer tipo pode ser utilizado, como por exemplo:
error NoFunds uint?
Outras mudanças
throw new SomeError("message")
em vez do api.err.SomeError("message")
. A forma anterior ainda está disponível, mas produzirá um warning. (#122)--help
melhorado, inclusive no modo de checagem de compatibilidade sdkgen compatibility --help
. (#131)xml
no retorno de chamadas REST. (#132)Correções
@description
e @arg
com múltiplas linhas no VSCode. (#128)bytes
como argumento de uma função no Android. (#134)Published by lbguilherme almost 4 years ago
Published by lbguilherme almost 4 years ago
Fix not including playground assets in the release package.
Published by lbguilherme almost 4 years ago
You can now bookmark endpoints on the playground. They are kept in your local storage.
The is a new annotation: @hidden
. It can be added to functions so that they won't show in generated client targets nor in the playground. But they will still exist and work. This can be used for deprecating an old function that no one should use anymore, but that exists for compactibility reasons.
@hidden // old function
fn getUsers(): User[]
Or to create REST-only functions, in combination with @rest
:
@hidden
@rest GET /menu/{menuId}/products
fn getProducts(menuId: uuid): Product[]
bigint
on latest TypeScript (#87, #92)@throws
annotation (#103)Thanks to @bira37, @joshuapassos, @MichelRibeiro1, @renatovassao, @daniloapr, @danielpsantiago, @lbguilherme, @dgadelha, @kevinoliveira!
Published by lbguilherme over 4 years ago
Refer to 1.2.0.
This fixes a bug on the release script. The package contents are the same.
Published by lbguilherme over 4 years ago
Refer to 1.2.0.
This fixes a bug on the release script. The package contents are the same.
Published by lbguilherme over 4 years ago
New Kotlin Android and .NET C# Server Targets:
We are pleased to announce two new targets for your projects. The new production ready Kotlin target for Android and the experimental C# Server target for .NET Core. They provide most of sdkgen's functionality ready for use. Please leave feedback or any bug you find on these.
New Type: html
A new type was added storing an html document. It is useful for implementing REST API's that should return a full web page.
@rest GET /news/{id}
fn getNewsPage(id: uuid): html
Other changes:
Published by lbguilherme over 4 years ago
New Feature: @rest
annotations:
It is now possible to add a @rest
annotation to any sdkgen function to have it exposed as a REST endpoint. Arguments can be received as path fragments, as query parameters, as headers and on the body. Parsing and strict type validation is all done for you. The function implementation itself is the same as always. The endpoint can also upload files with multipart/form-data, they will be available as part of sdkgen's context. A swagger is also made available on /swagger
when introspection is not disabled. (see #8, #18, #27)
New Type: bigint
A new primitive type has been added allowing integers of any size: bigint
. This is important for some applications that handle money. (see #28)
Other changes:
cep
, phone
, safehtml
and latlng
. Use string
or a custom object to replace them. (see #20)get
and function
keywords. fn
should be used instead. (see #19)deviceId
and requestId
to ensure they are unique and easy to use. (see #23)Published by lbguilherme over 4 years ago
Flutter:
null
, but the client will still work. Previously a exception were thrown. This allows the client to be used during unit testing (see #11, #12).Node/Browser:
date
or datetime
is expected it will be correctly received and treated as an ISO 8601 date. This feature existed on the currently deprecated cubos/sdkgen version and is now ported here. (Flutter support for this is still missing, see #14, #15).url
types (see #13)General:
master
branch. This way an unreleased version can be used.Flutter:
BuildContext
is now optional and can be omited when constructing an ApiClient
instance. When it is missing screen size and device locale won't be reported to the backend.Node:
server.introspection = false
to turn them off.General: