Atlassian-connect-validator in atlassian-connect-express

Recently we had case when typo in atlassian-connect descriptor did work for us in development and in production, but it appeared it was ignored indeed finally.

Of course we should have used atlassian-connect-validator to verify descriptor, but we forgot.

Well, it’s like flight accident in Guam, everything seemed right (including no userKey or username anywhere), but Marketplace did not recognise our apiMirgations (with typo) gdpr: true flag, and we almost crashed GDPR readiness project.

So, I decided to add validation to atlassian-connect-express, but none of the three nodejs json schema validators I’ve found (jsonschema, schema-validator, ajv) seem to provide that level of diagnosability as atlassian-connect-validator does. In particular, nodejs validators does not produce warning about unrecognised apiMirgations attribute as atlassian-connect-validator does.

Thus, question is, can anybody help with the idea to have same validation in atlassian-connect-express, please?

May be, simply, there is REST API in atlassian-connect-validator app on heroku?

Or maybe, someone knows how to do same validation in nodejs?

Or maybe Jira could do this when installing app in development?

Any thoughts or comments?

Note, I tried the following in atlassian-connect-express/lib/index.js#Addon:

        var ajv = new Ajv({schemaId: 'auto', allErrors: true});
        ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-04.json'));
        request.get('https://bitbucket.org/atlassian/connect-schemas/raw/master/jira-global-schema.json', function(err, res, schema) {
            if (!err && res.statusCode == 200) {
                var valid = ajv.validate(JSON.parse(schema), self.descriptor);
                console.log('validate', valid, ajv.errors);
            }
        });

Thank you.

1 Like

Hi @azhdanov,

We’re continuously trying to improve ACE and may I suggest adding a feature request here? I’ll look into it and add an item to improve this within ACE.

Cheers,
Anne Calantog

Hi Anna,

Created Atlassian Connect Express (Node.js) - Issues - Ecosystem Jira

Thank you.

1 Like

Hi @azhdanov,

Awesome. Thanks!

Cheers,
Anne

Hi @azhdanov,

Update - the atlassian-connect-validator is a combination of jsonschema validator and Atlassian’s connect schemas. I’m currently adding this validator on start of the app (only when tagged as development) but this won’t stop the developer from starting the app. I don’t want to disrupt the current flow of development of others but just to warn that there might problems with the descriptor that needs attention. Please follow the ticket for more update.

Cheers,
Anne

Feature already in production. You need to add "validateDescriptor": true in config.json for it to kick in. This defaults to false.

Cheers,
Anne

1 Like

Hi @acalantog ,
the atlassian-connect.json from ACE does not validate with the following errors:

Results
Incorrect Validation errors

lifecycle.installed
Description
does not conform to the "uri" format

baseUrl
Description
does not match pattern "^((https|http):\\/\\/.+|)$"

baseUrl
Description
does not conform to the "uri" format

Not sure how to handle this.

Hi @marc,

Thanks for your question. Can you please share your descriptor?

Cheers,
Anne

Hi @acalantog
Thank you for your followup question.

When following the tutorial https://developer.atlassian.com/cloud/confluence/lesson-1-the-source-awakens/ the atlas-connect command “installs” the following repository and atlassian-connect.json:
Bitbucket

The above error messages are from this linked atlassian-connect.json.