Commit 72994df6 authored by Bart's avatar Bart Committed by Bart

feat(): rename api_specification_type to api_type

parent d489c6fe
Pipeline #58533384 passed with stages
in 2 minutes and 44 seconds
......@@ -16,7 +16,7 @@ func TestDirectory(t *testing.T) {
"Test Organization Name",
"Test Service Name",
"Test API URL",
"Test Specification Type",
"Test API Type",
"Test Specification URL",
"Test Documentation URL",
[]models.Tag{"test tag"},
......
......@@ -16,16 +16,16 @@ func TestFile(t *testing.T) {
{
"./test-data/valid/company-service.json",
models.API{
ID: "company-service",
Description: "Test Description",
OrganizationName: "Test Organization Name",
ServiceName: "Test Service Name",
APIURL: "Test API URL",
APISpecificationType: "Test Specification Type",
SpecificationURL: "Test Specification URL",
DocumentationURL: "Test Documentation URL",
Tags: []models.Tag{"test tag"},
Badges: []string{"Gouden API"},
ID: "company-service",
Description: "Test Description",
OrganizationName: "Test Organization Name",
ServiceName: "Test Service Name",
APIURL: "Test API URL",
APIType: "Test API Type",
SpecificationURL: "Test Specification URL",
DocumentationURL: "Test Documentation URL",
Tags: []models.Tag{"test tag"},
Badges: []string{"Gouden API"},
Contact: models.APIContactDetails{
Email: "name@example.nl",
Phone: "0031612345678",
......
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL",
"tags": ["test tag"]
......
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL",
"tags": ["test tag"],
......
......@@ -7,7 +7,7 @@ type API struct {
OrganizationName string `json:"organization_name"`
ServiceName string `json:"service_name"`
APIURL string `json:"api_url"`
APISpecificationType string `json:"api_specification_type"`
APIType string `json:"api_type"`
SpecificationURL string `json:"specification_url"`
DocumentationURL string `json:"documentation_url"`
Tags []Tag `json:"tags"`
......
......@@ -87,7 +87,7 @@ func (rs APIResource) List(w http.ResponseWriter, r *http.Request) {
}
filters := map[string][]string{}
for _, key := range []string{"organization_name", "tags", "api_specification_type"} {
for _, key := range []string{"organization_name", "tags", "api_type"} {
values := utils.GetQueryParam(r, key)
if len(values) > 0 {
filters[key] = values
......
......@@ -21,7 +21,7 @@ var dummyAPI = models.API{
"Test Organization Name",
"Test Service Name",
"Test API URL",
"Test Specification Type",
"Test API Type",
"Test Specification URL",
"Test Documentation URL",
[]models.Tag{"test-tag"},
......@@ -39,7 +39,7 @@ var dummyImplementationOfReferenceAPI = models.API{
"Test Organization Name",
"Test Service Name",
"Test API URL",
"Test Specification Type",
"Test API Type",
"Test Specification URL",
"Test Documentation URL",
[]models.Tag{},
......@@ -84,21 +84,21 @@ func TestAPIList(t *testing.T) {
"/list",
200,
"application/json",
"{\"total\":0,\"facets\":{\"api_specification_type\":{\"field\":\"api_specification_type\",\"total\":0,\"missing\":0,\"other\":0},\"organization_name\":{\"field\":\"organization_name\",\"total\":0,\"missing\":0,\"other\":0},\"tags\":{\"field\":\"tags\",\"total\":0,\"missing\":0,\"other\":0}},\"apis\":[]}\n",
"{\"total\":0,\"facets\":{\"api_type\":{\"field\":\"api_type\",\"total\":0,\"missing\":0,\"other\":0},\"organization_name\":{\"field\":\"organization_name\",\"total\":0,\"missing\":0,\"other\":0},\"tags\":{\"field\":\"tags\",\"total\":0,\"missing\":0,\"other\":0}},\"apis\":[]}\n",
},
{
mockAPIDirectoryReaderOneResult,
"/list?tags=test-tag",
200,
"application/json",
"{\"total\":1,\"facets\":{\"api_specification_type\":{\"field\":\"api_specification_type\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Specification Type\",\"count\":1}]},\"organization_name\":{\"field\":\"organization_name\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Organization Name\",\"count\":1}]},\"tags\":{\"field\":\"tags\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"test-tag\",\"count\":1}]}},\"apis\":[{\"id\":\"test-api-name\",\"description\":\"Test Description\",\"organization_name\":\"Test Organization Name\",\"service_name\":\"Test Service Name\",\"api_url\":\"Test API URL\",\"api_specification_type\":\"Test Specification Type\",\"specification_url\":\"Test Specification URL\",\"documentation_url\":\"Test Documentation URL\",\"tags\":[\"test-tag\"],\"badges\":[],\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"}}]}\n",
"{\"total\":1,\"facets\":{\"api_type\":{\"field\":\"api_type\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test API Type\",\"count\":1}]},\"organization_name\":{\"field\":\"organization_name\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Organization Name\",\"count\":1}]},\"tags\":{\"field\":\"tags\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"test-tag\",\"count\":1}]}},\"apis\":[{\"id\":\"test-api-name\",\"description\":\"Test Description\",\"organization_name\":\"Test Organization Name\",\"service_name\":\"Test Service Name\",\"api_url\":\"Test API URL\",\"api_type\":\"Test API Type\",\"specification_url\":\"Test Specification URL\",\"documentation_url\":\"Test Documentation URL\",\"tags\":[\"test-tag\"],\"badges\":[],\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"}}]}\n",
},
{
mockAPIDirectoryReaderOneResult,
"/list?tags=tag-which-does-not-appear-for-any-result",
200,
"application/json",
"{\"total\":0,\"facets\":{\"api_specification_type\":{\"field\":\"api_specification_type\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Specification Type\",\"count\":0}]},\"organization_name\":{\"field\":\"organization_name\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Organization Name\",\"count\":0}]},\"tags\":{\"field\":\"tags\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"test-tag\",\"count\":1}]}},\"apis\":[]}\n",
"{\"total\":0,\"facets\":{\"api_type\":{\"field\":\"api_type\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test API Type\",\"count\":0}]},\"organization_name\":{\"field\":\"organization_name\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"Test Organization Name\",\"count\":0}]},\"tags\":{\"field\":\"tags\",\"total\":1,\"missing\":0,\"other\":0,\"terms\":[{\"term\":\"test-tag\",\"count\":1}]}},\"apis\":[]}\n",
},
}
......@@ -141,7 +141,7 @@ func TestAPIGet(t *testing.T) {
"./test-data/valid",
200,
"application/json",
"{\"description\":\"\",\"organization_name\":\"\",\"service_name\":\"\",\"api_url\":\"\",\"api_specification_type\":\"\",\"specification_url\":\"\",\"documentation_url\":\"\",\"tags\":null,\"badges\":null,\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"},\"scores\":{\"has_documentation\":false,\"has_specification\":false,\"has_contact_details\":false,\"provides_sla\":false}}\n",
"{\"description\":\"\",\"organization_name\":\"\",\"service_name\":\"\",\"api_url\":\"\",\"api_type\":\"\",\"specification_url\":\"\",\"documentation_url\":\"\",\"tags\":null,\"badges\":null,\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"},\"scores\":{\"has_documentation\":false,\"has_specification\":false,\"has_contact_details\":false,\"provides_sla\":false}}\n",
mockAPIFileReader,
}, {
"non-existing-api-id",
......@@ -223,7 +223,7 @@ func TestAPIImplementedBy(t *testing.T) {
"./test-data/valid",
200,
"application/json",
"[{\"id\":\"test-implementation-of-reference-api\",\"description\":\"Test Description\",\"organization_name\":\"Test Organization Name\",\"service_name\":\"Test Service Name\",\"api_url\":\"Test API URL\",\"api_specification_type\":\"Test Specification Type\",\"specification_url\":\"Test Specification URL\",\"documentation_url\":\"Test Documentation URL\",\"tags\":[],\"badges\":[],\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"relations\":{\"test-reference-api\":[\"reference-implementation\"]},\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"}}]\n",
"[{\"id\":\"test-implementation-of-reference-api\",\"description\":\"Test Description\",\"organization_name\":\"Test Organization Name\",\"service_name\":\"Test Service Name\",\"api_url\":\"Test API URL\",\"api_type\":\"Test API Type\",\"specification_url\":\"Test Specification URL\",\"documentation_url\":\"Test Documentation URL\",\"tags\":[],\"badges\":[],\"contact\":{\"email\":\"\",\"phone\":\"\",\"fax\":\"\",\"chat\":\"\",\"url\":\"\"},\"is_reference_implementation\":false,\"relations\":{\"test-reference-api\":[\"reference-implementation\"]},\"terms_of_use\":{\"government_only\":false,\"pay_per_use\":false,\"uptime_guarantee\":0,\"support_response_time\":\"\"}}]\n",
func(directory string) ([]models.API, error) {
return []models.API{
dummyImplementationOfReferenceAPI,
......
......@@ -23,13 +23,13 @@ func TestCreate(t *testing.T) {
wantResponseBody string
}{
{
"{\"id\":\"asdf\",\"description\":\"asdf\",\"organization_name\":\"asdf\",\"service_name\":\"asdf\",\"api_url\":\"asdf\",\"api_specification_type\":\"asdf\",\"specification_url\":\"asdf\",\"documentation_url\":\"asdf\", \"tags\":[], \"badges\":[]}\n",
"{\"id\":\"asdf\",\"description\":\"asdf\",\"organization_name\":\"asdf\",\"service_name\":\"asdf\",\"api_url\":\"asdf\",\"api_type\":\"asdf\",\"specification_url\":\"asdf\",\"documentation_url\":\"asdf\", \"tags\":[], \"badges\":[]}\n",
200,
"application/json",
"{\"id\":0,\"state\":\"\",\"title\":\"\",\"description\":\"\",\"created_at\":\"\",\"weight\":\"\",\"web_url\":\"\",\"labels\":null}\n",
},
{
"asdf{\"id\":\"\",\"description\":\"\",\"organization_name\":\"\",\"service_name\":\"\",\"api_url\":\"\",\"api_specification_type\":\"\",\"specification_url\":\"\",\"documentation_url\":\"\"}\n",
"asdf{\"id\":\"\",\"description\":\"\",\"organization_name\":\"\",\"service_name\":\"\",\"api_url\":\"\",\"api_type\":\"\",\"specification_url\":\"\",\"documentation_url\":\"\"}\n",
400,
"text/plain; charset=utf-8",
"bad request\n",
......
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL"
} invalid contents
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL",
"contact": {
......
......@@ -26,7 +26,7 @@ func NewIndex(apis *[]models.API) Index {
keywordFieldMapping.Analyzer = keyword.Name
apiMapping := bleve.NewDocumentMapping()
for _, value := range []string{"organization_name", "tags", "api_specification_type"} {
for _, value := range []string{"organization_name", "tags", "api_type"} {
apiMapping.AddFieldMappingsAt(value, keywordFieldMapping)
}
......@@ -163,7 +163,7 @@ func newQuery(q string, filters map[string][]string) query.Query {
func newSearchRequest(q query.Query) *bleve.SearchRequest {
searchRequest := bleve.NewSearchRequest(q)
for _, value := range []string{"organization_name", "tags", "api_specification_type"} {
for _, value := range []string{"organization_name", "tags", "api_type"} {
facet := bleve.NewFacetRequest(value, 50)
searchRequest.AddFacet(value, facet)
}
......
......@@ -14,7 +14,7 @@ var dummyAPI = models.API{
"Test Organization Name",
"Test Service Name",
"Test API URL",
"Test Specification Type",
"Test API Type",
"Test Specification URL",
"Test Documentation URL",
[]models.Tag{"test-tag"},
......@@ -32,7 +32,7 @@ var anotherDummyAPI = models.API{
"Test Organization Name",
"Test Service Name",
"Test API URL",
"Test Specification Type",
"Test API Type",
"Test Specification URL",
"Test Documentation URL",
[]models.Tag{"test-tag"},
......
......@@ -3,7 +3,7 @@
"organization_name": "Dummy organisatie",
"service_name": "Dummy ZRC",
"api_url": "https://",
"api_specification_type": "Custom",
"api_type": "Onbekend",
"specification_url": "",
"documentation_url": "https://www.duck.com",
"tags": ["zgw", "zrc", "dummy"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Eindhoven",
"service_name": "Contracten API",
"api_url": "https://testen.solviteers.nl/MijnApp/api",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://raw.githubusercontent.com/solviteers/mijnapp-api/master/contracten-api.yaml",
"documentation_url": "https://solviteers.github.io/mijnapp-api-contracts-docs-redoc/",
"tags": ["zaken", "contractgegevens", "mijnapp"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Gemeente Amsterdam",
"service_name": "Afvalcontainers en putten",
"api_url": "https://api.data.amsterdam.nl/afval/",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://api.data.amsterdam.nl/afval/redoc/?format=openapi",
"documentation_url": "https://api.data.amsterdam.nl/afval/",
"tags": ["afval", "containers", "putten"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Gemeente Amsterdam",
"service_name": "Beeldbank Amsterdam",
"api_url": "https://beeldbank.amsterdam.nl/api/",
"api_specification_type": "SOAP/XML",
"api_type": "SOAP/XML",
"specification_url": "https://beeldbank.amsterdam.nl/api/opensearch/description-document",
"documentation_url": "https://beeldbank.amsterdam.nl/",
"tags": ["beeldbank", "stadsarchief", "amsterdam", "fotos", "collectie"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Gemeente Amsterdam",
"service_name": "Monumenten",
"api_url": "https://api.data.amsterdam.nl/monumenten/",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://api.data.amsterdam.nl/monumenten/docs/api-docs/monumenten/?format=openapi",
"documentation_url": "https://api.data.amsterdam.nl/monumenten/",
"tags": ["gemeente", "amsterdam", "monumenten"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Kadaster",
"service_name": "Basisregistratie Adressen en Gebouwen (BAG)",
"api_url": "https://bag.basisregistraties.overheid.nl/api/v1/",
"api_specification_type": "OpenAPI3",
"api_type": "REST/JSON",
"specification_url": "https://rawgit.com/PDOK/open-api-specs/master/bag/oas.v1.yaml",
"documentation_url": "https://bag.basisregistraties.overheid.nl",
"tags": ["basisregistratie", "kadaster", "bag"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Kadaster",
"service_name": "Basisregistratie Kadaster (BRK)",
"api_url": "https://brk.basisregistraties.overheid.nl/api/v1",
"api_specification_type": "OpenAPI3",
"api_type": "REST/JSON",
"specification_url": "https://brk.basisregistraties.overheid.nl/api/v1",
"documentation_url": "https://brk.basisregistraties.overheid.nl/api/v1",
"tags": ["basisregistratie", "kadaster", "brk"]
......
......@@ -3,7 +3,7 @@
"organization_name": "Kadaster",
"service_name": "Basisregistratie Topografie (BRT)",
"api_url": "https://brt.basisregistraties.overheid.nl/api/v2",
"api_specification_type": "OpenAPI3",
"api_type": "REST/JSON",
"specification_url": "https://rawgit.com/PDOK/open-api-specs/master/brt/oas.v2.yaml",
"documentation_url": "https://brt.basisregistraties.overheid.nl",
"tags": ["basisregistratie", "kadaster", "brt"]
......
......@@ -3,7 +3,7 @@
"organization_name": "Ministerie van Binnenlandse Zaken en Koninkrijksrelaties (BZK)",
"service_name": "Omgevingsdocumenten Opvragen",
"api_url": "https://service.pre.omgevingswet.overheid.nl/publiek/omgevingsdocumenten/api/opvragen/v2",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://pre.omgevingswet.overheid.nl/knooppunt/apistore/api-docs/Kadaster/Omgevingsdocumenten-Opvragen/v2",
"documentation_url": "https://aandeslagmetdeomgevingswet.nl/publish/pages/155982/20181121_functionele_documentatie_ozon_api_omgevingsdocumenten_opvragen.pdf"
}
......@@ -3,7 +3,7 @@
"organization_name": "RDW",
"service_name": "Gekentekende voertuigen",
"api_url": "https://opendata.rdw.nl",
"api_specification_type": "None",
"api_type": "Onbekend",
"specification_url": "",
"documentation_url": "https://dev.socrata.com/foundry/opendata.rdw.nl/m9d7-ebf2",
"tags": ["basisregistratie", "rdw", "brv"]
......
......@@ -3,7 +3,7 @@
"organization_name": "Rijksmuseum",
"service_name": "Rijksmuseum API",
"api_url": "https://www.rijksmuseum.nl/en/api",
"api_specification_type": "none",
"api_type": "Onbekend",
"documentation_url": "https://rijksmuseum.github.io",
"tags": ["kunst", "agenda", "collectie"],
"contact": {
......
......@@ -3,7 +3,7 @@
"organization_name": "VNG Realisatie",
"service_name": "ZRC",
"api_url": "https://ref.tst.vng.cloud/zrc/api/v1/",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://ref.tst.vng.cloud/zrc/api/v1/schema/",
"documentation_url": "https://github.com/vng-Realisatie/gemma-zaakregistratiecomponent",
"tags": ["zgw", "zrc"],
......
......@@ -104,6 +104,7 @@ golang.org/x/net v0.0.0-20190415225723-1da14a5a36f2 h1:IGfhGSrexIBGJXC8r2UeAuyE4
golang.org/x/net v0.0.0-20190415225723-1da14a5a36f2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190420074925-afa5a82059c6 h1:gcNh9pPH/1RRswJ2D7lm9klsOJCXOhouLmyNNoT9WnE=
golang.org/x/net v0.0.0-20190420074925-afa5a82059c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190424034658-afe8014c977f h1:F0s01mO/APxRmEOraKdCq6HBkEIvgjSTzOpAPISzzqY=
golang.org/x/net v0.0.0-20190424034658-afe8014c977f/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190424112641-4829fb13d2c6/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA=
......
......@@ -17,7 +17,7 @@ export const referenceImplementationsFromRelations = relations =>
.keys(relations || {})
.filter(apiId => relations[apiId].includes(RELATION_TYPE_REFERENCE_IMPLEMENTATION))
const APIDetails = ({ id, service_name, organization_name, description, api_url, api_specification_type, specification_url, documentation_url, badges, is_reference_implementation, relations, terms_of_use, scores }) =>
const APIDetails = ({ id, service_name, organization_name, description, api_url, api_type, specification_url, documentation_url, badges, is_reference_implementation, relations, terms_of_use, scores }) =>
<div className="APIDetails">
<h1 className="title">{ service_name }</h1>
<h2 className="subtitle">{ organization_name }</h2>
......@@ -54,9 +54,14 @@ const APIDetails = ({ id, service_name, organization_name, description, api_url,
<a href={api_url} target="_blank" rel="noopener noreferrer">{ api_url }</a>
</dd>
<dt>API Type</dt>
<dd data-test="api-type">
{ api_type }
</dd>
<dt>API Specificatie</dt>
<dd data-test="api-specification-type">
<a href={getOnlineRedocUrl(specification_url)} target="_blank" rel="noopener noreferrer" data-test="api-specification-url">{ api_specification_type }</a>
<dd data-test="api-specification">
<a href={getOnlineRedocUrl(specification_url)} target="_blank" rel="noopener noreferrer" data-test="api-specification-url">Lees meer</a>
</dd>
<dt>Gebruiksvoorwaarden</dt>
......@@ -106,7 +111,7 @@ APIDetails.propTypes = {
organization_name: string.isRequired,
description: string.isRequired,
api_url: string.isRequired,
api_specification_type: string.isRequired,
api_type: string.isRequired,
specification_url: string.isRequired,
documentation_url: string.isRequired,
is_reference_implementation: bool,
......
......@@ -7,7 +7,7 @@ const details = {
"organization_name": "Organization Name",
"service_name": "Service Name",
"api_url": "API URL",
"api_specification_type": "Specification Type",
"api_type": "API Type",
"specification_url": "Specification URL",
"documentation_url": "Documentation URL",
"badges": ["Golden API", "Well-written docs"],
......@@ -63,10 +63,10 @@ describe('APIDetails', () => {
expect(apiURL.text()).toBe('API URL')
})
describe('specification', () => {
it('should show the specification type', () => {
const apiSpecType = wrapper.find('[data-test="api-specification-type"]')
expect(apiSpecType.text()).toBe('Specification Type')
describe('api type', () => {
it('should show the api type', () => {
const apiSpecType = wrapper.find('[data-test="api-type"]')
expect(apiSpecType.text()).toBe('API Type')
})
it('should link to Rebilly with the specification URL', () => {
......
......@@ -7,7 +7,7 @@ import CheckboxGroupField from '../CheckboxGroupField'
const filters = [
{ key: 'tags', label: 'Tags' },
{ key: 'organization_name', label: 'Organisatie' },
{ key: 'api_specification_type', label: 'API type' },
{ key: 'api_type', label: 'API type' },
]
class APIFilter extends React.Component {
......
......@@ -6,13 +6,13 @@ import CheckboxGroupField from '../CheckboxGroupField';
const filters = [
{ key: 'tags', label: 'Tags' },
{ key: 'organization_name', label: 'Organisatie' },
{ key: 'api_specification_type', label: 'API type' },
{ key: 'api_type', label: 'API type' },
]
const facets = {
tags: { terms: [ { term: '41', count: 5}, { term: '42', count: 100 } ]},
organization_name: { terms: [ { term: 'VNG', count: 10} ]},
api_specification_type: { terms: [ { term: 'OAS2', count: 5}, { term: 'OAS3', count: 75 } ]}
api_type: { terms: [ { term: 'gRPC', count: 5}, { term: 'GraphQL', count: 75 } ]}
}
describe('APIFilter', () => {
......@@ -20,7 +20,7 @@ describe('APIFilter', () => {
const testCases = [
{ terms: [], expected: [] },
{ terms: [ { term: '42', count: 5 } ], expected: [ { value: '42', label: '42 (5)', disabled: false }] },
{ terms: [ { term: 'OAS2', count: 5}, { term: 'OAS3', count: 0 } ], expected: [ { value: 'OAS2', label: 'OAS2 (5)', disabled: false }, { value: 'OAS3', label: 'OAS3 (0)', disabled: true } ] },
{ terms: [ { term: 'gRPC', count: 5}, { term: 'GraphQL', count: 0 } ], expected: [ { value: 'gRPC', label: 'gRPC (5)', disabled: false }, { value: 'GraphQL', label: 'GraphQL (0)', disabled: true } ] },
]
testCases.forEach((testCase) => {
......@@ -33,7 +33,7 @@ describe('APIFilter', () => {
const onSubmit = jest.fn()
const wrapper = mount(
<APIFilter
initialValues={{ tags: [], organization_name: [], api_specification_type: [] }}
initialValues={{ tags: [], organization_name: [], api_type: [] }}
facets={facets}
onSubmit={onSubmit}
/>
......@@ -48,7 +48,7 @@ describe('APIFilter', () => {
const onSubmit = jest.fn()
const wrapper = mount(
<APIFilter
initialValues={{ tags: [], organization_name: [], api_specification_type: [] }}
initialValues={{ tags: [], organization_name: [], api_type: [] }}
facets={facets}
onSubmit={onSubmit}
/>
......
......@@ -7,7 +7,7 @@ const details = {
"organization_name": "Organization Name",
"service_name": "Service Name",
"api_url": "API URL",
"api_specification_type": "Specification Type",
"api_type": "Specification Type",
"specification_url": "Specification URL",
"documentation_url": "Documentation URL",
"badges": ["Golden API", "Well-written docs"]
......@@ -60,7 +60,7 @@ describe('APIDetail', () => {
"organization_name": "Organization Name",
"service_name": "Service Name",
"api_url": "API URL",
"api_specification_type": "Specification Type",
"api_type": "Specification Type",
"specification_url": "Specification URL",
"documentation_url": "Documentation URL"
}
......
......@@ -56,14 +56,14 @@ class Overview extends Component {
if (newFilters.q !== currentFilters.q) {
newFilters.tags = []
newFilters.organization_name = []
newFilters.api_specification_type = []
newFilters.api_type = []
}
const translatedFilters = {
q: newFilters.q,
tags: newFilters.tags,
organisatie: newFilters.organization_name,
specificatie: newFilters.api_specification_type
type: newFilters.api_type
}
const { history } = this.props
......@@ -98,7 +98,7 @@ class Overview extends Component {
q: values.get('q') || '',
tags: values.getAll('tags'),
organization_name: values.getAll('organisatie'),
api_specification_type: values.getAll('specificatie')
api_type: values.getAll('type')
}
}
......
......@@ -86,7 +86,7 @@ describe('Overview', () => {
describe('getting the filters', () => {
it('should return the values from the query parameters', () => {
const wrapper = shallow(<Overview location={{ search: 'tags=42&organisatie=42' }} />)
expect(wrapper.instance().getQueryParams()).toEqual({ q: '', api_specification_type: [], organization_name: ['42'], tags: ['42']})
expect(wrapper.instance().getQueryParams()).toEqual({ q: '', api_type: [], organization_name: ['42'], tags: ['42']})
})
})
......@@ -103,7 +103,7 @@ describe('Overview', () => {
const history = { push: jest.fn() }
const wrapper = shallow(<Overview history={history} />)
wrapper.instance().onFilterChange({ q: '', api_specification_type: [], organization_name: ['42'], tags: ['42', '43'] })
wrapper.instance().onFilterChange({ q: '', api_type: [], organization_name: ['42'], tags: ['42', '43'] })
expect(history.push).toHaveBeenCalledWith('?tags=42&tags=43&organisatie=42')
})
})
......
......@@ -23,7 +23,7 @@ const SubmitAPI = () =>
"organization_name": "Voorbeeld van een organisatie naam",
"service_name": "Voorbeeld van een API naam",
"api_url": "https://api.example.com/service/",
"api_specification_type": "OpenAPI2",
"api_type": "REST/JSON",
"specification_url": "https://api.example.com/service/swagger/?format=openapi",
"documentation_url": "https://api.example.com/service/",
"tags": ["Voorbeeld tag", "Nog een tag"],
......
......@@ -22,7 +22,7 @@ const initialValues = {
organization_name: '',
service_name: '',
api_url: '',
api_specification_type: '',
api_type: 'Onbekend',
specification_url: '',
documentation_url: '',
tags: '',
......@@ -49,7 +49,7 @@ const validationSchema = Yup.object().shape({
organization_name: Yup.string().required(),
service_name: Yup.string().required(),
api_url: Yup.string().url().required(),
api_specification_type: Yup.string(),
api_type: Yup.string().required(),
specification_url: Yup.string().url(),
documentation_url: Yup.string().url(),
tags: Yup.string(),
......@@ -231,10 +231,10 @@ class SubmitAPIForm extends Component {
</div>
<div className="form-group">
<label htmlFor="api_specification_type">API specificatie</label>
<Field component="select" id="api_specification_type" name="api_specification_type"
<label htmlFor="api_type">API type</label>
<Field component="select" id="api_type" name="api_type"
className="form-control">
<option value="">Onbekend</option>
<option value="Onbekend">Onbekend</option>
<option value="REST/JSON">REST/JSON</option>
<option value="SOAP/XML">SOAP/XML</option>
<option value="gRPC">gRPC</option>
......@@ -243,8 +243,8 @@ class SubmitAPIForm extends Component {
<option value="WFS">WFS</option>
<option value="WMS">WMS</option>
</Field>
{errors.api_specification_type && touched.api_specification_type &&
<p className="text-danger">{errors.api_specification_type}</p>}
{errors.api_type && touched.api_type &&
<p className="text-danger">{errors.api_type}</p>}
</div>
<div className="form-group">
......@@ -352,8 +352,8 @@ class SubmitAPIForm extends Component {
.map(api => <option value={api.id} key={api.id}>{api.service_name} {api.organization_name}</option>)
}
</Field>
{errors.api_specification_type && touched.api_specification_type &&
<p className="text-danger">{errors.api_specification_type}</p>}
{errors.api_type && touched.api_type &&
<p className="text-danger">{errors.api_type}</p>}
</div> : null
}
......
......@@ -2,7 +2,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL"
}, foo bar baz
\ No newline at end of file
......@@ -2,7 +2,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL"
}, foo bar baz
\ No newline at end of file
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL"
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL"
}
\ No newline at end of file
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",
"api_specification_type": "Test Specification Type",
"api_type": "Test API Type",
"specification_url": "Test Specification URL",
"documentation_url": "Test Documentation URL",
"tags": ["test-tag"],
......
......@@ -3,7 +3,7 @@
"organization_name": "Test Organization Name",
"service_name": "Test Service Name",
"api_url": "Test API URL",