Skip to content

Commit

Permalink
Merge pull request #46 from adzerk/simonramzi/sc-48140/javascript-dec…
Browse files Browse the repository at this point in the history
…ision-sdk-ignores-some-fields

Added Skip Filters
  • Loading branch information
honeycomb-cheesecake authored Aug 14, 2023
2 parents e6fd1ae + ac6c16d commit c502ae0
Show file tree
Hide file tree
Showing 8 changed files with 522 additions and 161 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/publish-decision-spec-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish Decision Spec Packages

on:
release:
types: [published]

env:
WORKINGDIRECTORY_DECISION: build/ts/decision

jobs:
typescript:
name: Publish Typescript Package
runs-on: ubuntu-latest
steps:
- id: a9c19221-2149-41f2-91d7-e8411bf3ecc5
name: Checkout Repository
uses: actions/checkout@v3

- id: ba48f425-ccc1-4288-8ff6-4a1812e83224
name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18

- id: e75378b3-35d5-4f84-a871-d47e518f2d04
name: Install Dependencies
run: npm clean-install

- id: ced9f2a9-8b4a-4082-a0d1-7791c847d632
name: Build Typescript Components from Decision Spec
run: npm run build-decision-typescript

- id: db7f8f85-c695-48a1-acfc-a2898987dfa3
name: Copy Package Files into Working Directory
run: cp decision/package-config/npm/* ${WORKINGDIRECTORY_DECISION}

- id: db6068b8-f5ed-4968-847e-b642595243fd
name: Install Typescript Compiler Globally
run: npm install --global typescript

- id: e842d27d-141c-47f2-b64c-2c5702984edf
name: Compile Package
working-directory: ${WORKINGDIRECTORY_DECISION}
run: tsc --outDir dist --declaration *.ts

- id: edd89b5d-54fa-4951-8206-54b1cef91968
name: Configure Project-Level .npmrc File
working-directory: ${WORKINGDIRECTORY_DECISION}
run: npm config set --location=project @adzerk:registry=https://'${NPM_REGISTRY}' //'${NPM_REGISTRY}'/:_authToken='${NPM_SECRET}'

- id: c8734e87-1bb8-4340-9ab2-fd5cabb1ac6b
name: Update Version package.json to Released Version
working-directory: ${WORKINGDIRECTORY_DECISION}
run: npm pkg set "version"="${GITHUB_REF_NAME}"

- id: b5abe142-c11f-4951-8809-4bc118b4027d
name: Publish Package to NPM
env:
NPM_REGISTRY: registry.npmjs.org
NPM_SECRET: ${{ secrets.NPM_TOKEN }}
working-directory: ${WORKINGDIRECTORY_DECISION}
run: |
echo "Publishing tag ${GITHUB_REF_NAME} to ${NPM_REGISTRY}."
npm publish --dry-run
- id: c3c47fb3-2620-4dd1-898b-e867303278ea
name: Publish Package to GitHub Packages
env:
NPM_REGISTRY: npm.pkg.github.com
NPM_SECRET: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${WORKINGDIRECTORY_DECISION}
run: |
echo "Publishing tag ${GITHUB_REF_NAME} to ${NPM_REGISTRY}."
npm publish --dry-run
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Updated `@openapitools/openapi-generator-cli` to latest. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- Updated `generator-cli` version. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).

### Added

- This `CHANGELOG.md` file to track changes. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- Schema definition for `SkipFilters` in `decision/openapi-3.yaml`. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- `SkipFilters` parameter to Placement object in non-breaking, optional manner. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- Base information to project `package.json`. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- NPM build scripts to `package.json` for both the decision and management specifications. By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
- CI/CD workflow that allows for Typescript implementation of the api spec to be deployed as a package to a npm registry (currently a dry-run). By [@honeycomb-cheesecake](https://github.com/honeycomb-cheesecake).
31 changes: 31 additions & 0 deletions decision/openapi-3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ components:
type: number
format: float
nullable: true
skipFilters:
$ref: '#/components/schemas/SkipFilters'
User:
description: Object containing the UserKey used for [UserDB targeting](https://dev.adzerk.com/docs/userdb-1)
type: object
Expand Down Expand Up @@ -646,6 +648,35 @@ components:
type: string
lon:
type: string
GeoDistanceSkipFilter:
type: boolean
description: Geodistance filter, which skips geodistance targeting if true.
GeoLocationSkipFilter:
type: boolean
description: Geolocation filter, which skips location targeting if true.
SkipFilters:
type: object
properties:
distance:
$ref: '#/components/schemas/GeoDistanceSkipFilter'
facet:
type: boolean
description: Facet targeting filter, which skips facet targeting if true.
geodistance:
$ref: '#/components/schemas/GeoDistanceSkipFilter'
geolocation:
$ref: '#/components/schemas/GeoLocationSkipFilter'
keyword:
type: boolean
description: Keyword limit filter, which skips all (ad and/or flight) keyword targeting if true.
location:
$ref: '#/components/schemas/GeoLocationSkipFilter'
placementLimit:
type: boolean
description: Placement limit filter, where no advertiser placement limit if true.
siteZone:
type: boolean
description: Site/zone limit filter, which skips site/zone targeting if true.
securitySchemes:
ApiKeyAuth:
type: apiKey
Expand Down
1 change: 1 addition & 0 deletions decision/package-config/npm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Decision API Spec for Typescript
18 changes: 18 additions & 0 deletions decision/package-config/npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@adzerk/api-decision-js",
"description": "Decision API specification.",
"main": "dist/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/adzerk/adzerk-api-specification.git"
},
"files": [
"dist"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "Apache-2.0"
}
2 changes: 1 addition & 1 deletion openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "4.3.1"
"version": "5.1.0"
}
}
Loading

0 comments on commit c502ae0

Please sign in to comment.