Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RND-623] initial matchup to MetaEd api-schema plugin #300

Merged
merged 37 commits into from
Nov 6, 2023
Merged

Conversation

bradbanister
Copy link
Contributor

No description provided.

@@ -12,16 +12,19 @@ import {
AuthorizationStrategy,
TraceId,
ResourceInfo,
MetaEdProjectName,
MetaEdResourceName,
SemVer,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More branded strings to avoid getting them confused

@@ -15,7 +15,12 @@ export const setupConfigForIntegration = async () => {
return;
}

const path = join(process.cwd(), '.env');
// First look for .env file paired with this Config.ts file
let path = join(__dirname, '.env');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow for different .envs in each backend rather than force one big .env at root

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this

};

const referencedDocumentInfo: DocumentInfo = {
...newDocumentInfo(),
documentIdentity: { natural: 'delete5' },
documentIdentity: [{ natural: 'delete5' }],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document identity structure changed to enforce ordering

expect(result.outboundRefs).toMatchInlineSnapshot(`
[
"QtykK4uDYZK7VOChNxRsMDtOcAu6a0oe9ozl2Q",
"QtykK4uDYZK7VOChzZNTfqxhrlznYfnql5kIHg",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MeadowlarkIds changed due to DocumentIdentity changing to enforce ordering

@@ -90,12 +97,12 @@ export interface MeadowlarkDocument extends MeadowlarkDocumentId {
*/
export function newMeadowlarkDocument(): MeadowlarkDocument {
return {
meadowlark_id: undefined as unknown as MeadowlarkId,
document_uuid: undefined as unknown as DocumentUuid,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just wrong

@@ -9,9 +9,17 @@ import { CachedEnvironmentConfigProvider, Config } from '@edfi/meadowlark-utilit
import { join } from 'path';

export const setupConfigForIntegration = async () => {
const path = join(process.cwd(), '.env');
// First look for .env file paired with this Config.ts file
let path = join(__dirname, '.env');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allow for different .envs in each backend rather than force one big .env at root

throw new Error('Cannot run integration tests because there is no .env file in the repository root directory.');
// eslint-disable-next-line no-console
console.error(`Cannot run integration tests because there is no .env file in '${path}'`);
process.exit(-1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency with mongodb's setup

"jest": "^29.7.0",
"jest-environment-node": "^29.7.0",
"kafkajs": "^2.2.4",
"lerna": "^6.6.2",
"mongodb": "^5.9.0",
"pg": "^8.11.3",
"pg-format": "^1.0.4",
"prettier": "3.0.3",
"prettier": "2.8.8",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prettier 3.x not compatible with latest Jest's inline snapshot writing

static readonly uriVersion33b: string = 'v3.3b';

static readonly projectVersion33b: string = '3.3.1-b';

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplifying this

method: string,
statusCode?: number,
message?: string,
extra?: any,
): void {
if (isDebugEnabled()) {
Logger.debug(`${moduleName}.${method} ${statusCode ?? ''} ${message ?? ''}`.trimEnd(), request.traceId, extra);
Logger.debug(`${moduleName}.${method} ${statusCode ?? ''} ${message ?? ''}`.trimEnd(), traceId, extra);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplifying


const moduleName = 'ApiSchemaFinder';

const dataStandard50pre1Path: string = path.resolve(__dirname, '../ds-schemas/DataStandard-5.0.0-pre.1.json');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded to DS 5.0-pre.1 right now

): Promise<DocumentInfo> {
const documentIdentity: DocumentIdentity = extractDocumentIdentity(matchingMetaEdModel, body);
): DocumentInfo {
const documentIdentity: DocumentIdentity = extractDocumentIdentity(resourceSchema, body);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the extractors are rewritten, probably easier to look at them directly rather than try to follow the diff

*/
export async function metaed(_frontendRequest: FrontendRequest): Promise<FrontendResponse> {
const modelNpmPackage = modelPackageFor(Constants.uriVersion33b);
const { metaEd, metaEdConfiguration } = await loadMetaEdState(modelNpmPackage);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MetaEd is removed


// TODO: See RND-382 on what to do with this
function versionAbbreviationFor(_resourceVersion: SemVer): ProjectShortVersion {
return '3.3b' as ProjectShortVersion;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping this for now, RND-382 will probably change to '5.0.0-pre.1' for existing hardcode.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for this file. Should it be renamed? or removed?

@stephenfuqua stephenfuqua merged commit 9be8824 into main Nov 6, 2023
13 checks passed
@stephenfuqua stephenfuqua deleted the RND-623 branch November 6, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants