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

Update Core Spec to adhere to the Style Guide #619

Merged
merged 23 commits into from
Jun 23, 2023

Conversation

Coffee2Bits
Copy link
Contributor

@Coffee2Bits Coffee2Bits commented Jun 15, 2023

Description

Update the Core Spec to adhere to the style guide.

Linked Items:

Please include the items resolved by and/or associated with this Pull Request using the following syntax to link them for closure upon completion.
Closes #602

Type of change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Feature improvement

Feature Additions

Include pertinent changes as a result of adding the new feature.

  • None

Bug Fixes

Include pertinent changes of fixing the bug.

  • None

Breaking Changes

Include pertinent changes that qualify as breaking changes. Be sure to include information about the impact to end users and additional information for addressing the break if more than a version transition is necessary for mitigating.

  • Updated the Core Spec to adhere to the style guide
    • The schema definition is now named Schema
    • The model definition is now named Model
    • The root definition is now named Root
    • The enum definition is now named Enum
    • The extension definition is now named Extension
    • The enum BehaviorType's value are now UPPER_CASE
      • pub-sub is now PUB_SUB
      • request-response is now REQUEST_RESPONSE
      • startup is now STARTUP
      • timer is now TIMER
      • logging is now LOGGING
  • Removed several old definitions from the Core Spec
    • Map was moved to Gen-Protobuf
    • KeyValuePair was moved to Gen-Protobuf
    • Removed DefinitionReference as its been replaced by the primitive type reference
  • Updated First Party Plugins to adhere to the style guide

Feature Improvement Changes

Include pertinent changes that are improvements to existing features.

  • None

Checklist:

  • Updated documentation accordingly.
  • My changes generate no new warnings.
  • Have updated new and existing unit tests accordingly.
  • Linked associated items to be closed.
  • Have you bumped the version if there will be a release?

@Coffee2Bits Coffee2Bits self-assigned this Jun 15, 2023
@Coffee2Bits
Copy link
Contributor Author

For the removed AaC_CLI.yaml model was extracted to #620.

@Coffee2Bits Coffee2Bits marked this pull request as ready for review June 22, 2023 07:08
@@ -61,7 +61,7 @@ async def test_get_semantic_tokens_for_enum(self):

props = {
enum.name: {
enum.get_root_key(): (SemanticTokenTypes.Keyword, 0b11),
enum.get_root_key(): (SemanticTokenTypes.Keyword, 0b10),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated this to reflect the change in behavior in the token provider. I believe the 3 -> 2 change is because a number of these names no longer match the root key, which means it matches with one fewer of the bitmask checks.

Copy link
Contributor

@cvchaparro cvchaparro Jun 22, 2023

Choose a reason for hiding this comment

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

I think we still want this to be 0b11 as the bitmask indicates that a token is readonly and it is defined in the default library - i.e. defined in the core spec. As such, I think these root keys should always have both modifiers - i.e. 0b11. I think we need a slight modification of the logic in those two functions (linked above).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. Why are we considering root keys as readonly?

@lizzcondrey lizzcondrey linked an issue Jun 22, 2023 that may be closed by this pull request
5 tasks
Copy link
Contributor

@cvchaparro cvchaparro left a comment

Choose a reason for hiding this comment

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

Good job, so far. I have a few comments.

python/src/aac/lang/constants.py Outdated Show resolved Hide resolved
python/src/aac/lang/constants.py Outdated Show resolved Hide resolved
python/src/aac/lang/constants.py Outdated Show resolved Hide resolved
python/src/aac/spec/core.py Show resolved Hide resolved
python/tests/helpers/parsed_definitions.py Show resolved Hide resolved
python/tests/lang/test_language_context.py Outdated Show resolved Hide resolved
python/tests/lang/test_language_context.py Outdated Show resolved Hide resolved
python/tests/test_spec_core.py Outdated Show resolved Hide resolved
python/tests/test_spec_core.py Outdated Show resolved Hide resolved
@@ -61,7 +61,7 @@ async def test_get_semantic_tokens_for_enum(self):

props = {
enum.name: {
enum.get_root_key(): (SemanticTokenTypes.Keyword, 0b11),
enum.get_root_key(): (SemanticTokenTypes.Keyword, 0b10),
Copy link
Contributor

@cvchaparro cvchaparro Jun 22, 2023

Choose a reason for hiding this comment

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

I think we still want this to be 0b11 as the bitmask indicates that a token is readonly and it is defined in the default library - i.e. defined in the core spec. As such, I think these root keys should always have both modifiers - i.e. 0b11. I think we need a slight modification of the logic in those two functions (linked above).

Co-authored-by: Cameron Chaparro <cvchaparro@users.noreply.github.com>
Copy link
Contributor

@cvchaparro cvchaparro left a comment

Choose a reason for hiding this comment

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

Nice!

@Coffee2Bits Coffee2Bits merged commit 1605775 into pre-release-v0.2.0 Jun 23, 2023
18 checks passed
@Coffee2Bits Coffee2Bits deleted the alexcmonnet/i-want-the-core-spec-602 branch June 23, 2023 20:01
@Coffee2Bits Coffee2Bits mentioned this pull request Jun 23, 2023
9 tasks
lizzcondrey pushed a commit that referenced this pull request Jun 26, 2023
* I want a `Plugin` root key and schema (#500)

* Add Plugin and PluginCommand to spec.yaml

* Update describe-definition to take a reference

* Make ValidationReference and DefinitionReference actual references

* Spelling

* Improve naming

* Add command group schema and update plugin command schema

* Add a display name to command groups

* Add a display name to commands

* Update the gen-plugin architecture definition

* Update references.py

Clean up, refactor, and fix tests.

* Replace hard-coded string values with constants

* Update material model plugin definition

* Update commandGroup description

* Convert version plugin definition

* Convert validate plugin definition

* Fix goto definition test

* Convert gen_design_doc plugin definition

* Convert active_context plugin definition

* Put common command group definitions in spec.yaml

* Convert gen_gherkin_behaviors plugin definition

* Convert gen_json plugin definition

* Convert gen_protobuf plugin definition

* Convert help_dump plugin definition

* Convert gen_plant_uml plugin definition

* Convert lsp_server plugin definition

* Convert plugin_management plugin definition

* Convert print_spec plugin definition

* Convert rest_api plugin definition

* Convert specifications plugin definition

* Put descriptions on the same line

* Dedup constants that refer to the import root key

* Fix gen-protobuf test and minor cleanup

* More fixes for gen-gherkin-behaviors

* Keep up with spec.yaml changes

* Fix reference tests

* Update validator plugin definitions

* Make plugin definition files consistent

* Update definitions for primitive type checking plugin

* Update validators

Also, make the `when' step of validators read the same.

* Update docs

* Update plugin names in implementation files

* Fix imports

* Fix test file names

* Fix plugin management plugin tests

* Fix gen-design-doc generated output after template engine changes

A while ago we made changes to the template engine that made it so that we
didn't have to do as much spacing management in templates and this plugin never
got updated.

* Fix tests failing as a result of plugin name update

Now that plugin name doesn't necessarily equal the validation name for
validations, we need a way to distinguish between them.

* Rename usage of generate-openapi-spec to gen-openapi-spec

Update the OpenAPI spec generation command name for consistency with other
generation commands.

* Update plugin.yaml

Update the test plugin file to fully exercise plugin generation features.

* Add a few more definition field constants

* Update gen-plugin and tests

* Fix name

* Use updated field

* Put test helpers in another package

* Specify VALIDATION_NAME for each plugin

* Add description for `name' argument

* Add the right command dictionary

* Update clear_directory

* Initial updates to templates to acommodate new plugin format

* Updates gen plugin and tests

Update test with correct number of plugin files.

Move all plugin definition source files to the plugin directory for third-party
plugins.

* Fix things

* Try fixing docstring, again

* Updates to the pipeline

* Test plugin definition file updates

Add the test validation definitions.

Use relative file path on definition source value.

Switch command from description to helpText.

* Ignore D417 warnings in tests/ directory

* Update gen-openapi-spec command name

* Update validator implementation validation

We only need to care about validation implementations that are contributed by
active plugins.

* Update pipeline

* Fix flake8 warnings

* Fix command name

* Just use constructor for validation contributions

* Update validate validator implementation test

* Address the comment for TemporaryTestFile

* Fix parameters

* Fixes to TemporaryTestFile

* Update tests.helpers.io package

Also, since we're already touching these files go ahead and change references
from temporary_test_file to TemporaryTestFile.

* Use validator.optional

* Apply suggestions from code review

* Use an Enum instead of strings for the clean_up option

* Remove workaround for missing validator implementations in tests

* Promote specifications to core aac language (#559)

* initial mods, no testing yet

* removed commented out code

* Add Plugin and PluginCommand to spec.yaml

* Update describe-definition to take a reference

* Make ValidationReference and DefinitionReference actual references

* Spelling

* Improve naming

* Add command group schema and update plugin command schema

* Add a display name to command groups

* Add a display name to commands

* Update the gen-plugin architecture definition

* Update references.py

Clean up, refactor, and fix tests.

* Replace hard-coded string values with constants

* Update material model plugin definition

* Update commandGroup description

* Convert version plugin definition

* Convert validate plugin definition

* Fix goto definition test

* Convert gen_design_doc plugin definition

* Convert active_context plugin definition

* Put common command group definitions in spec.yaml

* Convert gen_gherkin_behaviors plugin definition

* Convert gen_json plugin definition

* Convert gen_protobuf plugin definition

* Convert help_dump plugin definition

* Convert gen_plant_uml plugin definition

* Convert lsp_server plugin definition

* Convert plugin_management plugin definition

* Convert print_spec plugin definition

* Convert rest_api plugin definition

* Convert specifications plugin definition

* Put descriptions on the same line

* Dedup constants that refer to the import root key

* Fix gen-protobuf test and minor cleanup

* More fixes for gen-gherkin-behaviors

* Keep up with spec.yaml changes

* Fix reference tests

* Update validator plugin definitions

* Make plugin definition files consistent

* Update definitions for primitive type checking plugin

* Update validators

Also, make the `when' step of validators read the same.

* Update docs

* Update plugin names in implementation files

* Fix imports

* Fix test file names

* Fix plugin management plugin tests

* Fix gen-design-doc generated output after template engine changes

A while ago we made changes to the template engine that made it so that we
didn't have to do as much spacing management in templates and this plugin never
got updated.

* Fix tests failing as a result of plugin name update

Now that plugin name doesn't necessarily equal the validation name for
validations, we need a way to distinguish between them.

* Rename usage of generate-openapi-spec to gen-openapi-spec

Update the OpenAPI spec generation command name for consistency with other
generation commands.

* Update plugin.yaml

Update the test plugin file to fully exercise plugin generation features.

* Add a few more definition field constants

* Update gen-plugin and tests

* Fix name

* Use updated field

* Put test helpers in another package

* Specify VALIDATION_NAME for each plugin

* Add description for `name' argument

* Add the right command dictionary

* Update clear_directory

* Initial updates to templates to acommodate new plugin format

* Updates gen plugin and tests

Update test with correct number of plugin files.

Move all plugin definition source files to the plugin directory for third-party
plugins.

* Fix things

* Try fixing docstring, again

* Updates to the pipeline

* Test plugin definition file updates

Add the test validation definitions.

Use relative file path on definition source value.

Switch command from description to helpText.

* Ignore D417 warnings in tests/ directory

* Update gen-openapi-spec command name

* Update validator implementation validation

We only need to care about validation implementations that are contributed by
active plugins.

* Update pipeline

* Fix flake8 warnings

* Fix command name

* Just use constructor for validation contributions

* Update validate validator implementation test

* Address the comment for TemporaryTestFile

* Fix parameters

* Fixes to TemporaryTestFile

* Update tests.helpers.io package

Also, since we're already touching these files go ahead and change references
from temporary_test_file to TemporaryTestFile.

* Use validator.optional

* Apply suggestions from code review

* Fix tests after merging

* Rename usages of DEFINITION_NAME_SCHEMA to ROOT_KEY_SCHEMA

* Remove original test_gen_plugin in favor of test_gen_plugin_impl

* Update requirement-related validations

* Fix validators

* Use an Enum instead of strings for the clean_up option

* Remove workaround for missing validator implementations in tests

* Fix test failures

* Simplify

* Clean up

---------

Co-authored-by: Cameron Chaparro <cameron.chaparro@zadentech.com>
Co-authored-by: Cameron Chaparro <cvchaparro@users.noreply.github.com>

* Make the import keyword a file wide declaration (#612)

* Update import root key in spec

* Update parser tests

Fix constant names and use the file name constants to define imports.

* Update gen_plugin tests

* Fix goto definition test

* Update parser handling of imports

* Update document link provider

* Fix the document link provider test

* Formatting

* Make sure we handle multiple import definitions per file

My intuition tells me this would be an antipattern but I think we should handle
that using a linting validator, rather than throwing an error.

* Update imports in models

* Make sure we provide imports list as a field

* Minor doc updates

* Add comments to documentation about imports

* Update docs

* Update spec.yaml with a definition structure for imports

* Update import references in definition files

* Update imports to use the new files field

* Update docstring

* Update README.md

* 615 remove the material plugin (#616)

* removed material plugin

* remove unit test and sample model

* disabled test that relied on material plugin model

* Removed skip test annotation and got the test working.

---------

Co-authored-by: Alex Monnet <alexcmonnet@gmail.com>

* AaC Style Guide (#613)

* Added user documentation on the AaC DSL Style Guide

Co-authored-by: Cameron Chaparro <cvchaparro@users.noreply.github.com>

* Update Core Spec to adhere to the Style Guide (#619)

* Updated the Core Spec to adhere to the AaC Style Guide
* Updated example models to adhere to the AaC Style Guide
* Updated first-party plugins to adhere to the AaC Style Guide

Co-authored-by: Cameron Chaparro <cvchaparro@users.noreply.github.com>

* Version bump

* Update Extension test

* Removed duplication spec consant

* Update dupe spec reference

* Removed unused constant

* Update gen puml yaml to use commands

* Readded nixed file docstring

* Moved genjson to commands

* Added parser error handling in line with the YAML error handling.

* Fixed parser import

---------

Co-authored-by: Cameron Chaparro <cvchaparro@users.noreply.github.com>
Co-authored-by: Cameron Chaparro <cameron.chaparro@zadentech.com>
Co-authored-by: Jondavid Black <36022341+jondavid-black@users.noreply.github.com>
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.

I want the Core Spec updated to the AaC Style Guide
2 participants