Skip to content

Instantly share code, notes, and snippets.

@edgars
edgars / mdl
Created July 24, 2025 20:53
mdl_sample.mdl
APPLICATION CustomerRegistrationApp
ENTITY Customer
FIELD CustomerID TYPE NUMERIC(10) KEY
FIELD Name TYPE ALPHANUMERIC(50) REQUIRED
FIELD BirthDate TYPE DATE REQUIRED
FIELD Email TYPE ALPHANUMERIC(100)
FIELD Age TYPE NUMERIC(3)
FIELD Status TYPE ALPHANUMERIC(1) DEFAULT "A"
END_ENTITY

POC KrakenD

Crie um arquivo chamado Dockerfile :

FROM devopsfaith/krakend

COPY krakend.json /etc/krakend/krakend.json

ENTRYPOINT [ "/usr/bin/krakend" ]

CMD [ "run", "-c", "/etc/krakend/krakend.json"]

Using Optic to generate your API Specs

You might have some APIs that, for some reason, don't have their OAS/Swagger file. Well, this post will show how you could save yourself in scenarios like that.

You can download Optic from here: https://useoptic.com. What I will show here is pretty much a recipe to fully understand how to use that tool.

Mocking APIs using json-server

#!/bin/bash
clear
echo stopping docker
docker stop $(docker ps -aq)
echo removing all contianers
docker rm $(docker ps -aq)
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx                  
helm repo update
helm install my-release ingress-nginx/ingress-nginx

Checando instalação

kubectl --namespace default get services -o wide -w my-release-ingress-nginx-controller

Fonte: https://kubernetes.github.io/ingress-nginx/deploy/

@edgars
edgars / adding.md
Last active October 22, 2020 03:07
post_docusaurus
$ yarn add @docusaurus/mdx-loader
$ yarn add swagger-ui-react
@edgars
edgars / swagger.yml
Created October 20, 2020 03:08
Livro_Jornada_Microservices
openapi: 3.0.2
info:
title: Jornada_Micro_Servicos
version: 1.0.0
description: API de Exemplo do Livro
paths:
/funcionarios:
summary: Path used to manage the list of funcionarios.
description: >-
The REST endpoint/path used to list and create zero or more `funcionario` entities. This path

Passo 1

Na pasta descompactada do curso:

mapperidea/curso/helloworld

Entrar na pasta onde tem o mapa mental (arquivo mdm):

curso/helloworld/mapper/mdm

openapi: 3.0.2
info:
title: OperacoesBancarias
version: 1.0.0
description: API de Pagamento
paths:
/clientes:
summary: Path used to manage the list of clientes.
description: >-
The REST endpoint/path used to list and create zero or more `Clientes` entities. This path
@edgars
edgars / sequence-fault.xml
Created August 8, 2020 00:29
Handling-Errors-EI-API
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="sequence-fault" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="full">
<property name="text" value="An unexpected error occured"/>
<property name="message" expression="get-property('ERROR_MESSAGE')"/>
</log>
<payloadFactory media-type="xml">
<format>
<error xmlns="">
<msg>$1</msg>