sdkgen

sdkgen is a tool to help design, implement and maintain good APIs with minimal effort

MIT License

Downloads
122.6K
Stars
68
Committers
37

Bot releases are hidden (Show)

sdkgen - 1.4.0

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

  • Lançamento de erros no Node.js deve ser feito através de throw new SomeError("message") em vez do api.err.SomeError("message"). A forma anterior ainda está disponível, mas produzirá um warning. (#122)
  • CLI está mais amigável com --help melhorado, inclusive no modo de checagem de compatibilidade sdkgen compatibility --help. (#131)
  • Suporte ao tipo xml no retorno de chamadas REST. (#132)
  • .NET 5.0 incluído no CI. (#135)
  • Atualização de dependências.

Correções

  • Informações do dispositivo Android e iOS agora são corretamente reportadas no Flutter. (#126)
  • Coloração de sintaxe corrigida para @description e @arg com múltiplas linhas no VSCode. (#128)
  • Correção no código de status HTTP em requisições REST em caso de erro Fatal. (#130)
  • Correção no envio do tipo bytes como argumento de uma função no Android. (#134)
sdkgen - 1.3.2

Published by lbguilherme almost 4 years ago

Refer to 1.3.0

  • Fix Android runtime CI publish script.
  • Fix Dart runtime failing to handle "float" values when they are actually an int (no fractional part).
  • Fix playground CSS for API's taller than your screen.
  • Fix Dart type errors not showing a friendly message.
sdkgen - 1.3.1

Published by lbguilherme almost 4 years ago

Refer to 1.3.0

Fix not including playground assets in the release package.

sdkgen - 1.3.0

Published by lbguilherme almost 4 years ago

Playground Bookmark (#96)

You can now bookmark endpoints on the playground. They are kept in your local storage.

image

Hidden annotation (#111)

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[]

Minor features:

  • Accept dates encoded as ISO 8601 on Node and Browser targets (#86)
  • Add constructor to all Flutter types, with proper annotation on required fields (#93)
  • Collect request duration (basic stats) on Android (#101, #102)
  • Improve Flutter type encoding and decoding (#109)

Fixes:

  • Fix deserialization of fields that are Kotlin reserved words on Android (#85)
  • Fix bigint on latest TypeScript (#87, #92)
  • Fix display of response and error on playground (#98, #99)
  • Fix throwing errors not covered by @throws annotation (#103)
  • Fix "Error:" prefix on error messages (#113)

Other changes:

  • Change identation to 2 spaces on the entire codebase, and add prettier (#106)
  • Add strict eslint to all typescript projects (#108)
  • Add Node 14 on CI
  • Add Flutter 1.12, 1.17, 1.20 and 1.22 on CI (#107)
  • Update dependencies

Thanks to @bira37, @joshuapassos, @MichelRibeiro1, @renatovassao, @daniloapr, @danielpsantiago, @lbguilherme, @dgadelha, @kevinoliveira!

sdkgen - 1.2.2

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.

sdkgen - 1.2.1

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.

sdkgen - 1.2.0

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:

  • Fixes for serialization on dart-runtime (#80, #75, #32, #31)
  • Improvements on apiTestWrapper for emulating request during unit testing (#77, #33, #30)
  • Fix displaying function name on browser network inspector (#76)
  • Fix for the "extra" property on node server (#72)
  • Add initial fingerprint implementation (no client support yet) (#49)
  • Add support for enums on rest annotation (#47)
  • Fix description annotation on struct fields (#43)
  • Improve decoding of dates (#44, #40)
  • Move browserUserAgent into "platform" (#34)
sdkgen - 1.1.0

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:

  • Removed some unused types: cep, phone, safehtml and latlng. Use string or a custom object to replace them. (see #20)
  • Drop Node 8 support (see #28)
  • Deprecate get and function keywords. fn should be used instead. (see #19)
  • Fix behavior with deviceId and requestId to ensure they are unique and easy to use. (see #23)
  • Update targeted ECMAScript version to ES2017, except on browser. (see #24)
  • Enable Prettier on all TypeScript code. (see #17)
  • Update dependencies. (see #21)
sdkgen - 1.0.65

Published by lbguilherme over 4 years ago

Flutter:

  • Fix: If the package manager isn't available, the information about app version will be 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:

  • When a string is passed as argument (or as return value) where a 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).
  • For nodeclient, fixed an issue where the result promise would never be resolved in case of a socket error while reading the response body (see #16)
  • Fix support for Node 8 for url types (see #13)

General:

  • A development version will always be generated from the master branch. This way an unreleased version can be used.
sdkgen -

Published by lbguilherme over 4 years ago

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:

  • A new runtime flag has been added to disable introspection features (playground, ast.json and dynamic target generation). Use server.introspection = false to turn them off.

General:

  • Unified into a single repository and introduce a new CI pipeline based on GitHub Actions.
  • Upgraded all dependencies (except some on playground).
  • Versioning is now consistent across all packages. A new version number is always released for all of them in sync, reducing confusion.
Package Rankings
Top 3.88% on Npmjs.org
Top 16.25% on Cocoapods.org
Badges
Extracted from project README
test status badge telegram badge
Related Projects