Open martinhalford opened 1 year ago
Is cicero get
just a wrapper of concerto get
or does it behave differently? Wondering if you tried the latter and had the same issue?
Hi @DianaLease - Interesting. I tried concerto get
and it worked fine.
This is the model.cto
:
namespace org.accordproject.helloemit@1.0.0
import org.accordproject.contract@0.2.0.{Clause, Contract} from https://models.accordproject.org/accordproject/contract@0.2.0.cto
import org.accordproject.runtime@0.2.0.{Request, Response, State, Obligation} from https://models.accordproject.org/accordproject/runtime@0.2.0.cto
/**
* The template model
*/
@template
asset TemplateModel extends Clause {
/**
* The name for the clause
*/
o String name
}
transaction MyRequest extends Request {
o String input
}
transaction MyResponse extends Response {
o String output
}
event Greeting {
o String message
}
I then ran the following command:
$ concerto get --model ./model.cto --output ./output
The output was as execped - just the @0.2.0
files:
$ cd output
$ ls -l
total 24
-rw-r--r--@ 1 martin staff 979 10 Aug 10:14 @models.accordproject.org.accordproject.contract@0.2.0.cto
-rw-r--r--@ 1 martin staff 1511 10 Aug 10:14 @models.accordproject.org.accordproject.runtime@0.2.0.cto
-rw-r--r--@ 1 martin staff 622 10 Aug 10:14 model.cto
I then ran the cicero command as follows:
$ cicero get
This is the output which also included the erroneous contract.cto
file:
$ cd model
model % ls -l
total 32
-rw-r--r--@ 1 martin staff 975 10 Aug 10:16 @models.accordproject.org.accordproject.contract.cto
-rw-r--r--@ 1 martin staff 979 10 Aug 10:16 @models.accordproject.org.accordproject.contract@0.2.0.cto
-rw-r--r--@ 1 martin staff 1511 10 Aug 10:16 @models.accordproject.org.accordproject.runtime@0.2.0.cto
-rw-r--r--@ 1 martin staff 622 10 Aug 10:14 model.cto
The file contract.cto
looked like this:
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
concerto version ">= 1.0.0"
namespace org.accordproject.contract
/**
* Contract Data
* -- Describes the structure of contracts and clauses
*/
/* A contract is a asset -- This contains the contract data */
abstract asset Contract identified by contractId {
o String contractId
}
/* A clause is an asset -- This contains the clause data */
abstract asset Clause identified by clauseId {
o String clauseId
}
Concerto: 3.12.0 Cicero: 0.24.1-20230722135139
Bug Report 🐛
Context
As part of the process of updating the unit tests for the Cicero repo, I am updating the many
model.cto
files to include the new Concerto syntax (e.g. adding versions to the namespaces, adding@template
toassets
and updatingimport
statements).Once these
model.cto
files have been updated, I am deleting all external model*.cto
files frommodel
folder in order to allow Cicero to correctly import the correct external reference files.This leaves a clean
\model
folder containing a singlemodel.cto
file.I then run
cicero get
which, I assumed, would pull the latest reference.cto
files from the Model Repository.Example
For example, starting with the following model file from [here](https://github.com/accordproject/cicero/blob/main/packages/cicero-cli/test/data/helloemit/model/model.cto) I modified it to be as so:
The
cicero get
command throws an error and drags in the obsolete@models.accordproject.org.accordproject.contract.cto
file.See command history:
Expected Behaviour
Failed to find an asset
error.@models.accordproject.org.accordproject.contract.cto
imported.@models.accordproject.org.accordproject.contract@0.2.0.cto
&@models.accordproject.org.accordproject.runtime@0.2.0.cto
.Context (Environment)