Skip to content

Commit

Permalink
resolve reviewers comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ManoelMilchev committed Feb 21, 2024
1 parent bf98fc9 commit 6de5ab5
Show file tree
Hide file tree
Showing 18 changed files with 326 additions and 352 deletions.
2 changes: 1 addition & 1 deletion _ft/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,4 @@ paths:
isFTAuthor: true
predicate: http://www.ft.com/ontology/annotation/mentions
prefLabel: Lawrence Summers
type: http://www.ft.com/ontology/person/Person
type: http://www.ft.com/ontology/person/Person
69 changes: 0 additions & 69 deletions commons/commons.go

This file was deleted.

49 changes: 0 additions & 49 deletions commons/commons_test.go

This file was deleted.

18 changes: 9 additions & 9 deletions config.dredd.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
content-types:
"application/vnd.ft-upp-live-blog-post+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:9000"
"application/vnd.ft-upp-live-blog-package+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:9000"
"application/vnd.ft-upp-article+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:9000"
"application/vnd.ft-upp-content-placeholder+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:9000"
end-point-health-checks:
"http://localhost:9000":
id: "check-draft-upp-live-blog-post-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-post-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog post content validator is not available at %v"
checker-name: "Draft content upp-live-blog-post-validator"
"http://localhost:9000":
id: "check-draft-upp-live-blog-package-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-package-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog package content validator is not available at %v"
checker-name: "Draft content upp-live-blog-package-validator"
"http://localhost:9000":
id: "check-draft-upp-article-validator"
business-impact: "Draft spark content article cannot be provided for suggestions"
business-impact: "Draft content article cannot be provided for suggestions"
name: "Check upp-article-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp article validator is not available at %v"
checker-name: "Draft content upp-article-validator"
"http://localhost:9000":
id: "check-draft-upp-content-placeholder-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-placeholder-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp placeholder validator is not available at %v"
checker-name: "Draft content upp-content-placeholder-validator"
checker-name: "Draft content upp-content-placeholder-validator"
18 changes: 9 additions & 9 deletions config.local.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
content-types:
"application/vnd.ft-upp-live-blog-post+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:8001"
"application/vnd.ft-upp-live-blog-package+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:8002"
"application/vnd.ft-upp-article+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:8003"
"application/vnd.ft-upp-content-placeholder+json":
validator: "spark"
validator: "generic"
end-point: "http://localhost:8004"
end-point-health-checks:
"http://localhost:8001":
id: "check-draft-upp-live-blog-post-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-post-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog post content validator is not available at %v"
checker-name: "Draft content upp-live-blog-post-validator"
"http://localhost:8002":
id: "check-draft-upp-live-blog-package-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-package-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog package content validator is not available at %v"
checker-name: "Draft content upp-live-blog-package-validator"
"http://localhost:8003":
id: "check-draft-upp-article-validator"
business-impact: "Draft spark content article cannot be provided for suggestions"
business-impact: "Draft content article cannot be provided for suggestions"
name: "Check upp-article-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp article validator is not available at %v"
checker-name: "Draft content upp-article-validator"
"http://localhost:8004":
id: "check-draft-upp-content-placeholder-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-placeholder-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp placeholder validator is not available at %v"
checker-name: "Draft content upp-content-placeholder-validator"
checker-name: "Draft content upp-content-placeholder-validator"
18 changes: 9 additions & 9 deletions config.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
content-types:
"application/vnd.ft-upp-live-blog-post+json":
validator: "spark"
validator: "generic"
end-point: "http://upp-live-blog-post-validator:8080"
"application/vnd.ft-upp-live-blog-package+json":
validator: "spark"
validator: "generic"
end-point: "http://upp-live-blog-package-validator:8080"
"application/vnd.ft-upp-article+json":
validator: "spark"
validator: "generic"
end-point: "http://upp-article-validator:8080"
"application/vnd.ft-upp-content-placeholder+json":
validator: "spark"
validator: "generic"
end-point: "http://upp-content-placeholder-validator:8080"
end-point-health-checks:
"http://upp-live-blog-post-validator:8080":
id: "check-draft-upp-live-blog-post-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-post-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog post content validator is not available at %v"
checker-name: "Draft content upp-live-blog-post-validator"
"http://upp-live-blog-package-validator:8080":
id: "check-draft-upp-live-blog-package-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-live-blog-package-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Live blog package content validator is not available at %v"
checker-name: "Draft content upp-live-blog-package-validator"
"http://upp-article-validator:8080":
id: "check-draft-upp-article-validator"
business-impact: "Draft spark content cannot be provided for suggestions"
business-impact: "Draft content cannot be provided for suggestions"
name: "Check upp-article-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp article validator is not available at %v"
checker-name: "Draft content upp-article-validator"
"http://upp-content-placeholder-validator:8080":
id: "check-draft-upp-content-placeholder-validator"
business-impact: "Draft spark content placeholder cannot be provided for suggestions"
business-impact: "Draft content placeholder cannot be provided for suggestions"
name: "Check upp-placeholder-validator service"
panic-guide: "https://runbooks.in.ft.com/draft-content-api"
severity: 1
technical-summary: "Draft upp content validator is not available at %v"
checker-name: "Draft content upp-content-placeholder-validator"
checker-name: "Draft content upp-content-placeholder-validator"
10 changes: 5 additions & 5 deletions draft/draft_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"net/http"
"strings"

"github.com/Financial-Times/draft-content-suggestions/commons"
"github.com/Financial-Times/draft-content-suggestions/config"
"github.com/Financial-Times/draft-content-suggestions/endpointEssentials"
"github.com/Financial-Times/go-logger/v2"
tidutils "github.com/Financial-Times/transactionid-utils-go"
)
Expand Down Expand Up @@ -46,7 +46,7 @@ func NewContentAPI(endpoint string, healthEndpoint string, httpClient *http.Clie
type ContentAPI interface {
FetchDraftContent(ctx context.Context, uuid string) (content []byte, err error)
FetchValidatedContent(ctx context.Context, body io.Reader, contentUUID string, contentType string, log *logger.UPPLogger) ([]byte, error)
commons.Endpoint
endpointEssentials.Endpoint
}

type draftContentAPI struct {
Expand Down Expand Up @@ -134,8 +134,8 @@ func BuildContentTypeMapping(validatorConfig *config.Config, httpClient *http.Cl
var service ContentValidator

switch cfg.Validator {
case "spark":
service = NewSparkDraftContentValidatorService(cfg.Endpoint, httpClient)
case "generic":
service = NewDraftContentValidatorService(cfg.Endpoint, httpClient)
default:
log.WithField("Validator", cfg.Validator).Fatal("Unknown validator")
}
Expand Down Expand Up @@ -175,5 +175,5 @@ func (d *draftContentAPI) IsGTG(ctx context.Context) (string, error) {
}

func (d *draftContentAPI) IsValid() error {
return commons.ValidateEndpoint(d.endpoint)
return endpointEssentials.ValidateEndpoint(d.endpoint)
}
Loading

0 comments on commit 6de5ab5

Please sign in to comment.