Muito bom, Gabriel!
Obrigado por continuar compartilhando suas soluções :)
Quando tivermos funcionalidade de fixar mensagens, com certeza essa ficaria fixada nesta aula.
Bruno Drugowick
Opa, excelente. Até voltei aqui pra usar o mesmo esquema do Gabriel.
Só uma coisa que não achei que faz sentido é criar uma lista e depois transformar em Array pra retornar ao invés de já criar um Array direto, então fiz assim:
private Tag[] tags() {
return new Tag[] {
new Tag("City", "Manage the cities"),
new Tag("Cuisine", "Manage the cuisines"),
new Tag("Group", "Manage the groups"),
new Tag("Group permission", "Manage the groups permissions"),
new Tag("Order", "Manage the orders"),
new Tag("Order status", "Manage the orders status"),
new Tag("Payment method", "Manage the payment methods"),
new Tag("Product photo", "Manage the products photos"),
new Tag("Restaurant", "Manage the restaurants"),
new Tag("Restaurant payment method", "Manage the restaurants payment methods"),
new Tag("Restaurant product", "Manage the restaurants products"),
new Tag("Restaurant user", "Manage the restaurants owners"),
new Tag("State", "Manage the states"),
new Tag("Statistic", "Manage the statistics"),
new Tag("User", "Manage the users"),
new Tag("User group", "Manage the users groups")
};
}
Abraços.
Gabriel Monteiro Fernandes
Oi Bruno,
Depois que eu aprendi esta maneira. Melhor de fato.
Fernando de Oliveira Melo
Olá, pessoal.
Aqui na solução proposta pelo Gabriel, entendi que ele instanciou um Array com as descrições customizadas para todos os controladores, mas não entendi a chamada no Docket:
.tags(tags()[0], tags());
Qual é a lógica dessa sintaxe?
Obrigado.
Abs
Alexandre Moraes TannusTutor
Bom dia Fernando,
Seguindo a documentação do Springfox, a função tags recebe no mínimo dois parâmetros, sendo o primeiro o item número 1 da lista de tags e o segundo a lista completa dos parâmetros, no seguinte formato.
public Docket tags(Tag first, Tag... remaining)
Como nesta aula apenas uma Tag foi criada, o parâmetro remaining pode ser omitido. Em aulas posteriores serão adicionadas novas tags, fazendo este parâmetro remaining se tornar um conjunto crescente de valores de Tags. No código postado pelo Gabriel ele passa como Tag first o item da posição zero do vetor e como Tag... remaining o vetor com todas as Tags, deixando a implementação mais limpa e fácil de manter.